E-commerce Website using Django
This project deals with developing a Virtual website ‘E-commerce Website’. It provides the user with a list of the various products available for purchase in the store. For the convenience of online shopping, a shopping cart is provided to the user. After the selection of the goods, it is sent for the order confirmation process. The system is implemented using Python’s web framework Django. To develop an e-commerce website, it is necessary to study and understand many technologies.
Scope: The scope of the project will be limited to some functions of the e-commerce website. It will display products, customers can select catalogs and select products, and can remove products from their cart specifying the quantity of each item. Selected items will be collected in a cart. At checkout, the item on the card will be presented as an order. Customers can pay for the items in the cart to complete an order. This project has great future scope. The project also provides security with the use of login ID and passwords, so that no unauthorized users can access your account. The only authorized person who has the appropriate access authority can access the software.
Technologies used in the project:
Django framework and SQLite database which comes by default with Django.
Required Skillset to Build the Project:
Knowledge of Python and basics of Django Framework.
ER and Use-Case Diagrams
- Customer shops for a product
- Customer changes quantity
- The customer adds an item to the cart
- Customer views cart
- Customer checks out
- Customer sends order
- Admin logs in
- Admin inserts item
- Admin removes item
- Admin modifies item
Step by Step Implementation:
- Create Normal Project: Open the IDE and create a normal project by selecting File -> New Project.
- Install Django: Next, we will install the Django module from the terminal. We will use PyCharm integrated terminal to do this task. One can also use cmd on windows to install the module by running python -m pip install django command
- Check Installed Django version: To check the installed Django version, you can run the python -m django -version command as shown below.
- Create Django Project: When we execute django-admin startproject command, then it will create a Django project inside the normal project which we already have created here. django-admin startproject ProjectName.
- Check Python3 version: python3 –version
- Run Default Django webserver:- Django internally provides a default webserver where we can launch our applications. python manage.py runserver command in terminal. By default, the server runs on port 8000. Access the webserver at the highlighted URL.
Open the project folder using a text editor. The directory structure should look like this :
Now add store app in E-commerce website in settings.py.
This file contains all the URL patterns used by the website
The below screenshot shows the required models that we will need to create. These models are tables that will be stored in the SQLite database.
Let’s see each model and the fields required by each model.
In views, we create a view named home.py, login.py, signup.py, cart.py, checkout.py, orders.py which takes a request and renders an HTML as a response. Create an home.html, login.html, signup.html, cart.html, checkout.html, orders.html in the templates. And map the views to the store\urls.py folder.
The below files show the views for each functionality of the site.
The project already includes a lot of features. The main beneficiaries are both customers and administrators who take longer to behave online. In addition, additional features can be identified and incorporated in the future. It will take more time and effort to understand the need and adjust it to a computerized system to accommodate additional features.