Skip to content

Repository files navigation

E_Shop · PRs Welcome

E_Shop is an innovative online store with two color themes (light/dark) for user convenience. Administrators have the ability to create products and manage them effectively. Users can easily add products to the cart, select the required quantity, and also use the implemented payment system for convenience during shopping. The simple and intuitive interface ensures ease of use for all users.


📍How to install:

📮Connect to Postman:


1.1 Import "Postman Collections" folder into Postman

1.2 Set the environment settings "User Data e_shop.postman_environment"

1.3 The "E_Shop_API.postman_collection" collection contains requests

1.4 Go to the Google Configuration, select "Change Sites" and set host

http://localhost:8000

1.5 Select "Social application"

To integrate the "Social application" with your project, follow these steps:

  • Visit Google Cloud Console and CREATE PROJECT
  • Navigate to APIs & Services > Credentials
  • Click on "Create Credentials" and choose "OAuth client ID"
  • Specify the application type as "Web application"
  • Set the name of your client (e.g., "Social App Client")
  • Under "Authorized redirect URIs," add the appropriate redirect URI for your application
  • Click "Create" to generate your OAuth client ID and client secret

Once created, copy and securely store the generated Client ID and Client secret.

    Client ID: Your_Client_ID
    Client secret: Your_Client_Secret

🔧Manual Installation:


2.1 Connect venv:

python3 -m venv venv

2.2 Activate it:

For Windows
.\venv\Scripts\activate

For MacOS

source venv/bin/activate 

2.3 Install libraries:

pip install -r requirements.txt

2.4 Create Your .env:

# Django configuration
SECRET_KEY=your_secret_key
DEBUG=1  # Set 1 or 0 
#
# PostgreSQL (docker/local)
DB_ENGINE=django.db.backends.postgresql_psycopg2
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_PORT=your_db_port
#
# pgadmin container
PGADMIN_DEFAULT_EMAIL=your_pgadmin_email
PGADMIN_DEFAULT_PASSWORD=your_pgadmin_password
#
# Stripe payment
STRIPE_PUBLIC_KEY=pk_key
STRIPE_SECRET_KEY=sk_key
#
# Settings Gmail SMTP
EMAIL_HOST_USER=your@gmail.com
EMAIL_HOST_PASSWORD=your_email_password

2.5 Create PostgreSQ DB:

Server > Data Bases > Create DB and give name
e_shop_db

2.6 Apply migrations:

python manage.py migrate

2.7 Install fixtures:

python commands.py

2.8 Run Commands:

Runserver:

python manage.py runserver

Celery worker:

celery -A E_Shop_config worker --loglevel=info

Celery beat:

celery -A E_Shop_config beat --loglevel=info

2.9 Use the following steps for configuration:

Go to Postman installation

1.4 Configure "Change Sites"

1.5 Configure "Social application"

🐳Connect to Docker Compose:


3.1 Create Your .env and set correct values:

echo "Creating .env file..."
cat <<EOL > .env
# Django configuration
SECRET_KEY=your_secret_key
DEBUG=1  # Set 1 or 0 
#
# PostgreSQL (docker/local)
DB_ENGINE=django.db.backends.postgresql_psycopg2
DB_NAME=your_db_name
DB_USER=your_db_user
DB_PASSWORD=your_db_password
DB_PORT=your_db_port
#
# pgadmin container
PGADMIN_DEFAULT_EMAIL=your_pgadmin_email
PGADMIN_DEFAULT_PASSWORD=your_pgadmin_password
#
# Stripe payment
STRIPE_PUBLIC_KEY=pk_key
STRIPE_SECRET_KEY=sk_key
#
# Settings Gmail SMTP
EMAIL_HOST_USER=your@gmail.com
EMAIL_HOST_PASSWORD=your_email_password
EOL

3.2 UP Docker-compose:

docker-compose up

3.3 Login to the container console:

docker exec -it django-container bash

3.4 Apply migrations:

python manage.py migrate

3.5 Install fixtures:

python commands.py

3.6 Use the following steps for configuration:

Go to Postman installation

1.4 Configure "Change Sites"

1.5 Configure "Social application"

3.7 Localhost Database Setup:

Create a database on localhost:5050
  • Open localhost:5050 in your browser.
  • Register the server.
  • In the connection settings:
    • Host: postgres-container
    • Username: postgres
    • Password: your_password

📂Detail information about project

⚠️Try the link to the website - (coming soon)⚠️

📚Additional Information


Connect to Stripe

1. Go to the Stripe registration page and create your profile:

Sign up for Stripe

2. Confirm your account.

3. Navigate to the following link to obtain your API keys and copy them:

Stripe API Keys

4. Paste to your .env:

STRIPE_PUBLIC_KEY=Publishable key
STRIPE_SECRET_KEY=Secret key

Test Cards:

  • Visa: 4242 4242 4242 4242
  • Mastercard: 5105 1051 0510 5100
  • American Express: 3782 822463 10005
  • Discover: 6011 1111 1111 1117

Connect to Google SMTP

1. Create app password at the following link:

Google App Passwords

2. Set the following in your settings:

EMAIL_HOST_USER=example@gmail.com
EMAIL_HOST_PASSWORD=example_code

User Credentials:

Admin:

admin@gmail.com
Testpass1

Basic User:

user@gmail.com
Testpass1

📸Screenshots


Explore the visual journey of our E-Shop with these captivating screenshots:

Light Mode Preview

Embrace the elegance of our Light Mode.

Dark Mode Preview

Experience the allure of our Dark Mode.

🤓Tips

Expose Localhost to the Internet using Serveo:

ssh -R 80:localhost:8000 serveo.net
ssh -o ServerAliveInterval=60 -R QvaShquai.serveo.net:80:localhost:8000 serveo.net

Dump data from Django apps to JSON files:

python manage.py dumpdata E_Shop_Products --indent 4 > mydemodata.json
python manage.py dumpdata E_Shop_Users --indent 4 > my_users_data.json

Load data back into Django apps:

python3 manage.py loaddata My_fixtures/my_products_data.json
python3 manage.py loaddata My_fixtures/my_users_data.json

Run Celery worker:

celery -A E_Shop_config worker --loglevel=info

Run Celery beat:

celery -A E_Shop_config beat --loglevel=info

Start Redis server:

redis-server

year-month-day

git commit --date="2023-05-05T12:00:00" -m "Updated"

Undo the last commit while keeping changes

git reset --soft HEAD~1

Resolve PostgreSQL port already in use

solve commands postgres already in use
sudo lsof -i :5432
sudo kill -9 <your_port>  
sudo rm /tmp/.s.PGSQL.5432.lock
sudo rm /tmp/.s.PGSQL.5432             
chmod 1777 /tmp

Run Django Tests:

python manage.py test

Run Tests with Coverage:

coverage run --source='.' manage.py test

Generate Coverage HTML Report:

coverage html

About

🔥Online shop repository! This Django-powered e-commerce platform is designed for a seamless shopping experience. Happy coding and happy shopping! 🚀

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages