4nm20cs139 Web-Report
4nm20cs139 Web-Report
Submitted To:
Dr Sarika Hegde
Associate Professor
Department of Computer Science
and Engineering
Submitted By:
ABSTRACT
Social networks constitute the greatest global information platform on the internet
today. They have become an indispensable part of our daily lives, As people
spend more time socializing on the internet.
The web project developed by Prathiksha Kini and Shanelle D’Mello simulates a
social media website called “Truffle” where the users can create, edit and update
their profiles with a strong authentication system provided inbuilt by the Django
framework. The logged in users can add, edit , download and delete posts,
search users, like and comment on the post as well as follow/unfollow other
users. The website hosts a user suggestion section where random users are
displayed on refreshing the page.
This project report will introduce how to build a social media web application
system using the Django framework. Django is an open-source web application
framework written in python. This social media web application system built using
Django has five major components with different functionalities that will be
introduced later. We will introduce various features of the Django framework and
SQLite3 RDBMS in the later section. In the end, snapshots are attached to
demonstrate UI.
ii
Social Media Website
TABLE OF CONTENTS
TitlePage .............................................................................................................................. 1
Abstract................................................................................................................................ 2
TableofContents .................................................................................................................. 3
Introduction ......................................................................................................................... 4
ProblemStatement............................................................................................................... 4
Objectives ............................................................................................................................ 5
Methodology ........................................................................................................................ 7
ImplementationDetails ...................................................................................................... 10
Results ............................................................................................................................... 13
References ......................................................................................................................... 17
iii
Social Media Website
INTRODUCTION
The project aims to create a desirable social media application for users with a
suitable UX design and proper backend management.
• The project uses the Django web framework (python framework) to implement
the social media application.
• HTML, Bootstrap, CSS, SCSS and Django Template Language implement the
front-end to customize the user interface.
PROBLEM STATEMENT
Truffle is a Django based social media website where users can utilize the
features exactly as on other straightforward social media websites. The goal of
the project was to demonstrate how the most popular web development
languages might be utilized to create a straightforward social media website.
Features:
As mentioned above, this application system has five vital components/features:
User registration/authentication, User posts, Search users, Like and Comment
on user posts and Follow/Unfollow users.
• User posts: Once the user has registered and set up a profile, they can post
photos and modify them accordingly. Users can like and comment and download
the posts.
• Follow/Unfollow users: The logged in user can follow/unfollow users from the
user suggestion section.
• Search users: Users can search other users by entering the username in the
search bar provided in the home page. A list of all users matching the username
typed will appear as a search result.
Objective:
Presenting a straightforward yet distinctive website that suits the demands of a
user like any other social media websites. The project created is a social media
web application where visitors may register and utilize the features exactly as
on other straightforward websites. The system will be built using the Django
web framework and the Bootstrap framework for the frontend design.
Hardware Requirements:
Django framework doesn't have many system requirements. Since it's primarily
written in python, the system requirements must satisfy to install Python
language. Similarly, SQLite3 can also run on any modern system. Hardware
requirements for this project are primarily concerned with the system hardware
requirements (PC). We recommend Intel Core i3 processor or above for the
development phase with a minimum 4GB PC Ram and HDD or SSD hard disk.
Server end hardware requirements aren't significant for this project because we
can host this project on the cloud with various services.
Software Requirements:
This social media application application uses python language for development
with SQLite database management system. We have used the Django
framework version 4.1.3 and hence we have to use python version 3.6 or above
and SQLite version 3.8 or above. The Integrated Development Environment used
for this project is Visual Studio Code.
METHODOLOGY
The project will be developed using an iterative and incremental approach. The
first step will be to define the requirements and design the system architecture.
This will involve identifying the various components of the system and their
interactions, as well as defining the user flows and functionalities. Once the
requirements and design are finalised, the implementation phase will begin. This
will involve the development of the various components of the system, including
the user interface, database, and backend logic. The system will be tested and
refined throughout the development process to ensure that it meets the
requirements and provides a smooth and efficient user experience.
Model: Model is a single, definitive data source that contains the essential field
and behavior of the data. Python classes implement models. Usually, one model
is one table in the database. Each python object in the model represents a field
of a table in the database. Django provides a set of automatically generated
database application programming interfaces (APIs) for the convenience of
users.
View: A view is a short form of the view file. It is a file containing a Python
function that takes web requests and returns web responses. A response can be
HTML content or XML documents or a “404 error” and so on. The logic inside the
view function can be arbitrary as long as it returns the desired response. To link
the view function with a particular URL, we need to use a structure called
URLconf that maps URLs to view functions.
Template: Django’s template is a simple text file that can generate a text-based
format like HTML and XML. The template contains variables and tags. Variables
will be replaced by the result when the template is evaluated. Tags control the
logic of the template. We also can modify the variables by using filters. For
example, a lowercase filter can convert the variable from uppercase into
lowercase. Django templates allow the developers to implement the front-end
logic of the application.
Step 1 : The UI for the project was designed using HTML, CSS, SCSS,
Bootstrap and Javascript.
Step 2: Once the frontend was designed a schema was created for different
models:
Step 3: Views are written to write the underlying logic that needs to be displayed
on the frontend in views.py file and routes are configured in urls.py file.
IMPLEMENTATION
Installation Steps:
Step 1: Open VS Code or any other editor of your choice and Install virtualenv
using the command pip install virtualenv in the terminal.
virtualenv env
env/scripts/activate
A development server will be started run the website in any browser and ensure
proper internet connection.
The Python and Django built in Functions used for the project:
Python’s in built random function was used to shuffle the users randomly in
user suggestions section.
Len function was used to find the number of posts posted by user, number
of followers etc.
This section covers most of the Django query sets and raw SQL that have been
used in the blog application. Query sets are the list of objects that have been
created using the models. We can perform operations such as add, delete,
retrieval, and many more. It's implemented in python and can interact with
database tables.
• Filter method: filter() method is used when we need to perform queries with
certain conditions. We have used the filter method to filter the blogs based on
category.
• All method: The simplest way to retrieve an object (tuple) from the database
table is to call all() method when using query sets.
• __icontains method: The simplest way to search an object (tuple) from the
database table is to call __icontains() method when using query sets.
Views used:
Models are created for each table with its attributes specified. The operations are
then done with inbuilt methods in Django.
CRUD in Django
● Updating with is done by changing the fields for the fetched object , again with
save() method
Django Form-Validation
The is_valid() method is used to perform validation for each field of the form, it is
defined in Django Form class. It returns True if data is valid and place all data
into a cleaned_data attribute.
As the goal was set most of the implementations and requirements have be
passes and test cases been solved. Some problems for developer like error
correction did become a hassle as we are new to this subject, but at the end a
fruitful website was created together.
Future Scope can include integrating our application with a real time chat
application that could serve the demand of the users on a successful social
media web application.Working on the backend can be time-consuming and yet
can be simplified when working with the Django framework. SQLite3 provides a
robust and flexible Database Management System that is very suited for the
scalability of products.
Extensions or development of the database tables so that a better database can
be provided. No software is perfect, good maintenance an update to the trend is
what will make any software shine.
SQLite3 database works at its best, backed by the authentication and security
features of Django.
REFERENCES