How mhdhamka/django-ecommerce-website works
Project Type and Purpose
• This is a full-stack eCommerce website built on Django (Python) providing user authentication, product catalog, cart/checkout flows, payment integration (Razorpay), order management, and an admin panel.
• The file tree shows a standard Django “project” (ecomm/) with multiple “apps” (accounts, home, products, base), plus templates, static/media assets, migration scripts, and configuration files (.env, settings.py).
File Structure Analysis
• Top-level “ecomm” directory: ASGI/WSGI entry points, settings, URL routing.
• Apps (“accounts”, “products”, “home”, “base”): each follows Django’s MVT pattern (models.py, views.py, urls.py, forms.py, migrations/).
• Templates: organized by app, plus shared “base” templates.
• Static/media under public/media: CSS, JS, fonts, images for the frontend.
• requirements.txt, .env.example, manage.py: environment management and project bootstrapping.
README Insights
• Clearly lists features (auth, cart, checkout, payments, responsive UI, admin).
• Technologies: Django backend, HTML/CSS/JS + Bootstrap frontend, Razorpay API for payments.
• Deployment hints: uses environment variables for SECRET_KEY, DEBUG, and social-auth settings.
a. Main Components
• Clients (Web browser/mobile)
• Django Web Server (ASGI/WSGI + Gunicorn or similar)
• Django Apps (accounts, products, home, base) implementing business logic
• Django ORM and Database (PostgreSQL/SQLite)
• Static/Media File Storage (local filesystem or CDN)
• External Services: Razorpay Payment Gateway, SMTP/email provider, (optional) Google OAuth via django-allauth
b. Relationships & Data Flows
• HTTP/HTTPS requests from clients → Django URL dispatcher → appropriate app view → template rendering or JSON response
• Views invoke business logic → ORM queries → Database
• Checkout flow: server initiates Razorpay payment session via HTTPS → client completes payment → Razorpay webhooks → server updates Order records
• Email flows: server sends account activation and order notifications via SMTP
• Admin Panel: Django admin front-end → ORM → Database
c. Architectural Patterns & Principles
• Django’s MVT (Model-View-Template) modular pattern
• Separation of concerns: each app owns its domain (users, products, home pages, shared utilities)
• Environment-driven config (.env) for credentials and debug toggles
• Reusable templates and static assets managed via Django’s staticfiles system
d. Key Technologies
• Backend: Python, Django, Gunicorn/ASGI
• Frontend: HTML5, CSS3, JavaScript, Bootstrap
• Database: PostgreSQL or SQLite (via Django ORM)
• Payment: Razorpay REST APIs
• Email: SMTP or external email-service integration