How lechiluan/ecommerce works
Project Overview & Architecture
• This project is a full-stack e-commerce system built with Python and Django. It is divided into multiple Django apps – primarily "customer", "dashboard", and "main" – each responsible for different aspects of the overall system.
• Its purpose is to provide a comprehensive online shopping experience: customers can browse, search, order products and interact with an integrated chatbot; administrators manage products, orders, customers, and see analytics.
• The system uses standard Django architecture (MTV pattern) with clearly separated frontend and backend logic.
Primary System Components
a. Client/Browser:
• Represents users interacting with the system.
• Both “Customer” and “Administrator” roles.
b. Web Server / Django Application:
• Consists of several Django apps:
▪ Customer App: Contains views, templates, and static files designed for customer-facing pages (shopping, cart, checkout, registration, login, product filtering, etc.).
▪ Dashboard App: Provides the administrator interface for managing products, orders, payments, customers, sales statistics, and chatbot management.
▪ Main App: Contains core functionalities, user registration, and shared components like contextual processors.
• The central project configuration is managed through the “ecommerce” directory (settings, URL configurations, WSGI/ASGI) which routes requests appropriately.
c. Database:
• The application uses PostgreSQL in production (Heroku) but also includes a local SQLite database for development/testing (db.sqlite3).
d. External Services & Cloud Integration:
• Cloudinary: For image storage.
• Email Service: For password resets, account verifications and notifications.
• reCaptcha: To verify human users during login/registration.
• Chatbot Integration: Managed through Dialogflow via the dashboard.
• Deployment Platforms: Heroku (primary) and Railway (backup).
e. Static & Media Files:
• Static assets are segmented into static directories (per app and central staticfiles) covering CSS, JavaScript, and images.
• Media directory holds uploaded images like brand logos, product images, and customer images.
Relationships and Data Flow
• Client requests travel via the Django routing (configured in ecommerce/urls.py, main/urls.py, customer/urls.py, dashboard/urls.py) and are handled by the relevant app’s views.
• Business logic in each Django app interacts with models that persist data to the database.
• For customer functions (product browsing, cart management, checkout), interactions flow from the browser, through the customer or main app, and update the database.
• Administrative functions (managing products, orders, reviews, chatbot) are processed in the dashboard app and access the same central database.
• External interactions include sending emails (triggered upon registration or order placement) and transferring images to Cloudinary.
Architectural Patterns & Design Principles
• Adoption of the Django MTV (Model-Template-View) pattern.
• Separation of concerns: distinct Django apps are deployed to isolate customer versus admin functionalities.
• Environment variable configuration (.env file for sensitive data) for external services (email, database, Cloudinary).
• Use of version control (Git) and deployment pipelines (Procfile, runtime.txt for Heroku).
Final Touches
• Frontend (client/browser interfaces)
• Backend services (Django apps, business logic)
• Databases and external integrations
• Detailed interfaces showing how a customer flow (like placing an order) and an admin flow (like viewing sales statistics or managing products) traverse multiple components.