E-commerce web app created with Python, Django, JS and Bootstrap4 that integrates the following concepts:
- usage of Django authentication system to handle the site access and user authorization – extending User object with one-to-one model,
- using Django ORM to perform CRUD operations on SQLite database,
- usage of Signals to perform actions triggered by the user,
- usage of Sessions to pass data between the views,
- PayPal API integration to process payments.
This Django project runs in the development mode and the below setup guide assumes that it will be run on a local machine:
-
Create your virtual environment to install necessary packages to run the project
conda create --name yourenvname
- this will be a command to use if you are using Anaconda to manage your virtual environments -
Activate your virtual environment.
conda activate yourenvname
-
Install requried packages to run the project by using requirements.txt file.
conda install --file requirements.txt
-
Install PayPal checkout server by typing:
pip install paypal-checkout-serversdk
-
You will need to have Paypal sandbox account created to be able to set the below values.
https://developer.paypal.com/docs/api/overview/#create-sandbox-accounts -
Following setup would be needed in the project to be able to test the Paypal payments:
-
in the /detailing_store/settings.py file:
PAYPAL_RECEIVER_EMAIL = "Replace this text with your PayPal sandbox business email"
-
in the detailing_store/shopping_basket/paypal.py file:
self.client_id = "Replace this text with your PayPal sandbox business CLIENT ID"
self.client_secret = "Replace this text with your PayPal sandbox business CLIENT SECRET"
-
in the shopping_basket/templates/shopping_basket/checkout.html file:
<script src="https://www.paypal.com/sdk/js?client-id=YOUR_CLIENT_ID¤cy=GBP&disable-funding=sofort"></script>
Replace YOUR_CLIENT_ID with your PayPal sandbox client ID.
-
-
Now with your env active you should be able to successfully run the project by using usual django command:
python manage.py runserver
-
Create admin user if you would like to have access to admin dashboard:
python manage.py createsuperuser
Standard users can be added by clicking Sign up button on the main page. -
The database is preloaded with a 20 fake products so the migrations would not be needed.
Runing project screenshot:
Database visualization diagram: