This is a blog application build on Django Framework.
- It is recommended to use a virtual environment for running the project (e.g. virtualenv), execute following commands on terminal
pip install virtualenv
virtualenv -p python3 env
- Now navigate inside the
env
folder
cd env/
- Now start the virtual environment by executing following commands in terminal
source bin/activate
- Now clone/download the repo inside the
env
folder Click
git clone https://github.com/vishalpolley/Blog-App.git
- Navigate inside the repository folder
cd Blog-App/
- Now install the required python packages by using the following commands in terminal
sudo pip install -r requirements.txt
- Navigate inside the src folder.
cd src/
- Create a superuser by using following command
python manage.py createsuperuser
- Now run the Django server by using
python manage.py runserver
- Navigate to page and enter the URL
http://localhost:8000/
The blog application contains two major application components -
- Account Application - (contains user login, register, logout functions)
- Posts Application - (contains post create, list, detail, update, delete functions)
The account application uses the Default Django User model.
The functionality of various components of account application are explained as follows -
The user registration view/form contains following three parameters -
username
- char field, required field, uniqueemail
- email field, required fieldpassword
- password field, required field
http://localhost:8000/register/
- The Register form checks for any validation errors and on success redirects to the post main page
http://localhost:8000/posts/
The user login view contains following two parameters -
username
- char field, required field, uniquepassword
- password field, required field
http://localhost:8000/login/
- The Login form checks for any validations errors and on successful login, the page redirects to the main page.
http://localhost:8000/posts/
The current login user can logout from the application by clicking on logout
option on the navigation bar of the blog application.
http://localhost:8000/logout/
The post application provides various functionality of post creation, updation, deletion which are explained as below -
The post creation view/form contains following parameters as -
title
- char field, required fieldcontent
- text field, required fieldimage
- image field, non required field
http://localhost:8000/posts/create/
-
A logged in user can only create a new post. If the user is not logged in, he/she can only view the post contents.
-
The post create form also checks for validation errors on various fields.
-
On successful creation of the post the page redirects to the main post lists page
http://localhost:8000/posts/
The post update view/form contains following parameters as -
title
- char field, required fieldcontent
- text field, required fieldimage
- image field, non required field
http://localhost:8000/posts/id/edit/
where id
is the id of the post.
-
Only the creator of the post is able to update his/her post.
-
On successful updation of the post the page redirects to the particular post.
The post list view shows various posts by different users in the form of a scrollable list.
http://localhost:8000/posts/
-
The Post List view contains a
search
field which narrows the search results of the posts for the values of title, content, and username. -
The Post List view contains
pagination
feature which paginates the pages if post contents exceeds 10.
The post delete view provides post deletion feature for the post app.
http://localhost:8000/posts/id/delete/
where id
is the id of the post.
-
Only the creator of the post is able to delete his/her post.
-
On successful deletion of the post, the page redirects to the main page containing all posts.
The post detail view shows the contents of the particular post.
http://localhost:8000/posts/id/
where id
is the id of the post.
- The Post detail view shows option for post
update
and postdelete
for the creator of the post. And for other users the options are disable over that post.