A full-featured e-commerce web application built with Django, featuring user authentication, shopping cart functionality, order management, and payment processing.
- User Management: Registration, login, logout, and account activation
- Product Catalog: Browse products with categories, brands, and detailed information
- Shopping Cart: Add, remove, and manage items in your cart
- Order Processing: Complete order workflow with status tracking
- Payment Integration: Secure payment processing
- Responsive Design: Mobile-friendly interface
- Admin Panel: Django admin for managing products, orders, and users
Django-E-commers-Course/
βββ account/ # User authentication and account management
βββ cart/ # Shopping cart functionality
βββ edshop/ # Main Django project settings
βββ media/ # User uploaded files
βββ order/ # Order processing and management
βββ payment/ # Payment processing
βββ static/ # Static files (CSS, JS, images)
βββ templates/ # HTML templates
βββ tests/ # Test files
βββ web/ # Main web application (products, categories)
βββ manage.py # Django management script
βββ pyproject.toml # Project dependencies and configuration
βββ README.md # This file- Backend: Django (Python)
- Database: Postgres
- Frontend: HTML, CSS, JavaScript
- Styling: Custom CSS with Font Awesome icons
- Development Tools:
- Ruff (linting and formatting)
- Pre-commit hooks
- pytest (testing)
- uv (dependency management)
- Python 3.11+
- uv (recommended) or pip for dependency management
git clone https://github.com/FEMADOX/Django-E-commers-Course.git
cd Django-E-commers-Course# Using uv (recommended)
uv sync
# Or using pip
pip install -r requirements.txtcp .env.example .env
# Edit .env with your configurationCreate a .env file in the project root with the following configuration (or use the provided .env.example as a template):
# Django Settings
DJANGO_SECRET_KEY="skz02xGaSTY5fsDAf9nQJPl4xYUuk2nc7OC4NixADN(*@!)(*@YJIO#)"
DEBUG=True
ALLOWED_HOSTS="127.0.0.1"
CORS_ORIGIN_WHITELIST="http://127.0.0.1"
CSRF_TRUSTED_ORIGINS="http://127.0.0.1"
# Choices production | development
ENVIRONMENT="development"
# Use local database (SQLite) if True, else use PostgreSQL
LOCAL_DATABASE=True
# Payment Processing
STRIPE_API=your-stripe-api-key
# Email Configuration
EMAIL_HOST_USER=your-email@example.com
EMAIL_HOST_PASSWORD=your-app-password
# Database Configuration
DATABASE_URL=your-database-url-here
# Cloudinary (Media Storage)
CLOUD_NAME=your-cloudinary-name
CLOUD_API_KEY=your-cloudinary-api-key
CLOUD_API_SECRET=your-cloudinary-api-secretNote: Never commit your
.envfile to version control. Add it to your.gitignorefile.
python manage.py migratepython manage.py createsuperuserpython manage.py runserverVisit http://127.0.0.1:8000 to see the application.
For a containerized development environment, you can use Docker Compose to run the application with PostgreSQL.
- Docker and Docker Compose installed on your system
- Clone the repository (as shown in Quick Start section)
Create a .env.docker file in the project root:
... # Like the previous .env file but with these changes:
LOCAL_DATABASE=False # Use Dockerized Postgre instead of SQLite (local)
# Database Configuration (PostgreSQL)
DATABASE_URL=postgres://[postgres_user]:[postgres_password]@[postgres_host]:[postgres_port]/[postgres_database]
...# Build and start all services
docker-compose up --build
# Or run in detached mode
docker-compose up -d --build- Django application:
http://localhost:8000 - PostgreSQL database runs on port 5432 (internal to containers)
# Stop all services
docker-compose down
# View logs
docker-compose logs
docker-compose logs web # Only web service logs
docker-compose logs db # Only database logs
# Execute this command to create the superuser
docker-compose exec web python manage.py createsuperuser
# Access the web container shell
docker-compose exec web bash
# Access PostgreSQL database
docker-compose exec db psql -U postgres -d postgresThe Docker setup includes:
- Volume mounting: Your local code is mounted to
/appin the container, so changes are reflected immediately - PostgreSQL database: Persistent data storage with Docker volumes
- Hot reloading: Django development server automatically reloads on code changes
- Dependency management: Uses
uvfor fast Python package installation
-
web: Django application container
- Based on Python 3.11
- Runs on port 8000
- Auto-reloads on code changes
-
db: PostgreSQL database container
- PostgreSQL latest
- Data persisted in
postgres_datavolume - Default credentials: postgres/postgres
Run the test suite:
pytestRun specific test module:
pytest tests/test_module_dirRun only unit tests or integration tests:
# Unit tests
pytest -m unit
# Integration tests
pytest -m integrationRecomendation: Use pytest with the plugin xdist for parallel test execution:
pytest -n auto # Automatically uses all available CPU cores
pytest -n 4 # Specify number of CPU cores
pytest -n auto --dist loadscope # Distribute tests by scopeThis project uses Ruff for linting and formatting:
python run_ruff.py
# or
ruff check .Install pre-commit hooks to ensure code quality:
pre-commit installThis project includes comprehensive instructions for AI coding assistants (GitHub Copilot, Cursor, etc.) to help with development:
- Location:
.github/copilot-instructions.md - Purpose: Guides AI assistants on project architecture, conventions, and patterns
- Benefits:
- Faster onboarding for new developers using AI tools
- Consistent code generation following project patterns
- Understanding of session-based cart, email auth, and other custom implementations
- Automatic awareness of testing conventions and type annotation requirements
GitHub Copilot and compatible AI tools will automatically read these instructions when working in this repository.
- User registration and authentication
- Account activation via email
- User profile management
- Login/logout functionality
- Session-based shopping cart
- Add/remove products
- Quantity management
- Price calculations
- Product catalog
- Category and brand management
- Product search and filtering
- Product detail pages
- Order creation and management
- Order status tracking
- Order history
- Payment processing integration
- Transaction management
The application uses a responsive design with:
- Custom CSS styling
- Font Awesome icons
- Google Fonts (Montserrat, Open Sans)
- Mobile-first approach
This project is created for educational purposes as part of a Django e-commerce course.
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For questions and support, please open an issue on GitHub.
Built with β€οΈ using Django