How medurubharath/advanceswep works
Project Type and Purpose
• This is a monolithic, full-stack e-commerce web application built with Django (Python).
• It follows Django’s MTV (Model-Template-View) pattern, serving HTML pages to customers and providing an admin interface.
• Key features: product catalog, shopping cart, checkout, user authentication, order management, media uploads.
File Structure
• Top-level Django project:
• Eshop/ (settings.py, urls.py, wsgi.py, asgi.py)
• manage.py, db.sqlite3, requirements.txt
• Single Django app “store/” with sub-directories:
• models/ (category.py, product.py, customer.py, orders.py)
• views/ (home, cart, checkout, login, signup, orders)
• templates/ (HTML pages)
• templatetags/ (custom template filters, tags)
• migrations/ (DB schema evolution)
• middlewares/ (authentication middleware)
• uploads/ (product images)
Core Architectural Components
a. Client Tier
• Web browser or mobile client making HTTP(S) requests.
b. Web Server / Framework
• Django invoked via ASGI/WSGI (Eshop/asgi.py, Eshop/wsgi.py).
• Gunicorn/Uvicorn (if deployed), or built-in dev server (manage.py runserver).
c. URL Dispatcher
• Eshop/urls.py → include store/urls.py.
d. Middleware Layer
• store/middlewares/auth.py for request pre-processing (e.g., session check).
e. Controllers (Views)
• store/views/*.py handle business logic: cart.py, checkout.py, etc.
f. Template Layer
• store/templates/*.html rendered by Django Template Engine.
g. Model Layer (ORM)
• store/models/*.py define Product, Category, Customer, Order, OrderStatus.
• Migrations track schema.
h. Database
• SQLite (db.sqlite3). Could be Postgres/MySQL in production.
i. Media Storage
• store/uploads/products (local filesystem). Could be S3 in prod.
j. Django Admin
• store/admin.py exposes management UI.
Relationships & Data Flows
• Client → HTTP Request → ASGI/WSGI server
• Server → Middleware → URL Routing
• Routing → View function/class →
• Query Model (ORM) → Database
• Read/Write Media Files
• Invoke business logic (e.g., adding to cart)
• View → Template Engine → Render HTML → HTTP Response → Client
• Admin UI similarly goes through URL→View→Model.
Architectural Patterns & Principles
• MTV pattern (Model-Template-View).
• Single monolithic Django app; not microservices.
• Layered architecture: Presentation (templates), Controller (views), Persistence (models, DB).
• Separation of concerns: custom middleware for auth, templatetags for view-agnostic logic.