Full stack project with payment integration and also the ability of the user to do shopping as Registered user and also as a Guest user
install python3.9 version to make sure everythinh works
Setup and activate your Virtual Environment for Django for windows
pip install virtualenv
Start virtualenv In your windows command prompt, head to your project location:
cd my_project
Once inside the project folder run:
virtualenv env
Activate virtualenv On Windows, virtualenv (venv) creates a batch file called
virtualenv env
To activate virtualenv on Windows
env\Scripts\activate
Install Required Python Modules
pip install -r requirements.txt
Installing the project
open terminal and type
TODO GITHUB URL
or simply download using the url below
THE GITGUB URL
python manage.py makemigrations
python manage.py migrate
open terminal and type
python manage.py collectstatic
To create superuser open terminal and type
python manage.py createsuperuser
Then go to http://127.0.0.1:8000in your browser
Home Page (Store page )
Cart Page
Checkout Page for Registered user
Checkout Page for Guest user
Login Page
Profile Page
Edit Profile Page
project coding files
online django admin page details with all the models that registered in the apps admin pages
ecommerce settings.py
A Django settings file contains all the configuration of your Django installation.
project main urls.py
this is the main urls file for all the apps in the project so it contains the urls for store app , and accounts app urls.
- path('accounts/', include('django.contrib.auth.urls'))
this url for DJANGO site authentication urls (the login , logout , password management)
- path('accounts/', include('accounts.urls')),
for other authentication pages
- path('' , include('store.urls')),
for the STORE app
models.py
A model is the single, definitive source of information about my data. It contains the essential fields and behaviors of the data iam storing. Generally, each model maps to a single database table.
and in this app , need tables for (Customer, Product , Order, OrderItem , ShippingAddress)
Customer table with its columns
Product table with its columns
Order table with its columns
OrderItem table with its columns
ShippingAddress table with its columns
admin.py
to register store models and show it on the admin panal page of django
views.py
A view function, or view for short, is a Python function that takes a Web request and returns a Web response. This response can be the HTML contents of a Web page, or a redirect, or a 404 error, or an XML document, or an image . . . or anything, really. The view itself contains whatever arbitrary logic is necessary to return that response
so views === logic of the app and here need views for :
- store ( home page)
- product_detail
- cart
- checkout
- updateItem
- process_order
and here the code pages for all the views above
- store view
- product details view
- cart view
- checkout view
- orderItem view
- process_order view
urls.py
this file contains pages needed urls in store app like :
- store
- product_details
- cart
- checkout
- update_item
- process_order
vtils.py
file for dont repeat the code in the views
contains the css , js , fonts and images files that needed in the whole project .
A Django template is a text document or a Python string marked-up using the Django template language. Some constructs are recognized and interpreted by the template engine. The main ones are variables and tags.
A template is rendered with a context. Rendering replaces variables with their values, which are looked up in the context, and executes tags. Everything else is output as is.
The syntax of the Django template language involves four constructs.
so in my project .. there are templates for store app , accounts app and also main.html page template that all pages inherited from .
this app for user authentication pages so it contains the details of login , logout , signup , and password management .... and also for profile (social login)
models.py
contains classes that i need to add in database to manage accounts pages and profile page
admin.py
forms.py
forms for signup , user and profile
views.py
signup view and also prodile , edit_profile view
- signup view
- profile and edit_profile views
urls.py
for signup page , also prodile , edit_profile
to integrate paypal into the website to allow the user to checkout either with the default paypal checkout option or with the debit credit card that also provided with paypal .
to add paypal buttons to the checkout page go to this link
here working with client side integration so using sandbox accounts to send and recieve the payments
paypal in checkout page
django-filter
pip install django-filter
django-crispy-forms
pip install django-crispy-forms
Riyam Hazim Email: cs50riyam211@gmail.com
========Thank You !!!=========