Clone the project from github
git clone https://github.com/ShukuraliProgrammer/e-commerce.git
Enter the project directory
Create a virtual environment
python3 -m venv venv
Activate the virtual environment
> For Linux
source venv/bin/activate
> For Windows
venv\Scripts\activate
Create Database in you local machine
- sudo -i -u postgres
- psql
- CREATE DATABASE e_commerce;
- CREATE USER e_commerce WITH PASSWORD 'e_commerce';
- ALTER ROLE e_commerce SET client_encoding TO 'utf8';
- ALTER ROLE e_commerce SET default_transaction_isolation TO 'read committed';
- ALTER ROLE e_commerce SET timezone TO 'UTC';
- GRANT ALL PRIVILEGES ON DATABASE e_commerce TO e_commerce;
Generate a secret key
python3 -c 'from django.core.management.utils import get_random_secret_key; print(get_random_secret_key())'
Create .env
file and paste all credentials that copied from .env.example
like below, put in above generated secret key to SECRET_KEY
variable
# Base Configuration
SECRET_KEY=key
DEBUG=True
ALLOWED_HOSTS=127.0.0.0.1, localhost
# Database Configuration
DB_NAME=e_commerce
DB_USER=e_commerce
DB_PASSWORD=e_commerce
DB_HOST=localhost
DB_PORT=5432
Install all requirements
pip install -r requirements/develop.txt
Migrate the database
python manage.py migrate
Create superuser
python manage.py createsuperuser
Run the project
python manage.py runserver