How kc-7/ecommerce works
Overall Project Type and Purpose
• This is a full‑stack e‑commerce web application built with Django. It’s designed to offer custom printed products featuring AI‑generated art. It also includes an administrative portal (powered by Jazzmin), integrated payment processing (Stripe), external file storage (AWS S3), and a relational database (PostgreSQL via ElephantSQL on Heroku).
• The readme and file tree show that the application is divided carefully into multiple Django apps such as “about”, “avatar”, “bag”, “blog”, “checkout”, “products”, and “profiles”. This modular (MVC pattern) structure is key to the system’s internal architecture.
Main Components/Subsystems
• Client/Presentation Layer:
– Web Browser (user devices accessing the site). This layer is responsible for rendering HTML/CSS/JS that is generated by Django templates.
– Mobile and Desktop clients with responsive UI (since the README details extensive responsiveness testing).
• Web Application Server (Business Logic Layer):
– Django Project (“ecommerce”) deployed on Heroku. This central server routes HTTP requests via Django URL routing, then directs them to the appropriate views/controllers in each app.
– Multiple Django apps (about, avatar, bag, blog, checkout, products, profiles) each with their own models, views, templates, forms, and tests.
– An Admin Portal using Jazzmin for administrative functionality and custom management (e.g., product CRUD, blog and about page management, and custom avatar generation).
• Data Persistence Layer:
– A relational database (using PostgreSQL via ElephantSQL on production; support for sqlite in development). All models (users, orders, products, blog pages, avatar attributes, etc.) persist here.
– Data migrations and schema definitions are part of each app.
• External Services and Integrations:
– Payment Gateway: Stripe integration (with configuration for test and live modes, webhooks, and secure keys).
– File Storage and CDN: AWS S3 is used for static and media file storage. The Django-storages integration with boto3 handles upload/download.
– Authentication & Social Login: Django-allauth is set up for user registration, login, email verifications, etc.
– Cloudflare DNS and SSL: For custom domain support, HTTPS enforcement, and additional security.
– Deployment Tools: Git (with GitHub) for version control and Heroku as the hosting platform (including Procfile configuration).
– Other: Services like CKEditor for rich-text editing; various JavaScript and CSS frameworks (Bootstrap, custom styles) used in the front end.
Relationships and Interactions
• The browser makes secure HTTPS requests to Heroku’s hosted Django server.
• The Django server routes requests across its modular apps based on URL patterns. For example:
– Public users access product listings, blog pages, and profile pages.
– Administrative users access the Jazzmin‑enhanced admin portal where CRUD actions occur.
• The business logic interacts with the database to read/write models.
• Payment flows are managed via Stripe: checkout views prepare order data, redirect users or confirm transactions, and listen for webhook events (handled by Django views like webhook_handler.py).
• Static assets and media files are served from AWS S3 based on custom storage backends defined in settings.
• Additional integrations such as AWS S3, Cloudflare, and allauth are connected via well‑defined configuration (environment variables are set on Heroku, for example).
Architectural Patterns and Technologies
• The overall architecture follows the MVC (Model‑View‑Controller) pattern. Django’s projects and apps separate the business logic, presentation, and data layers.
• It is deployed as a monolithic application—one Django project with modular apps—while still using Micro‑service–like external integrations (Stripe, S3).
• Environment configuration and version control (via git) support agile development, as detailed extensively in the README.