How divanov11/django-course works
Project Type & Purpose
• This is a monolithic, full-stack Django web application (“DevSearch”) that combines traditional server-rendered pages (HTML/CSS/JS) with a REST API (Django REST Framework).
• Users can register, log in, share projects, message other developers, rate work, and search profiles/projects.
High-Level Architecture Components
a. Clients & Entry Points
• Web Browser (end-user)
• Third-party API clients (e.g., mobile app or JS fetch calls to /api/)
b. Edge & Delivery Layer
• Heroku Router / Load Balancer (or Nginx)
• CDN or WhiteNoise for static assets (CSS/JS/images under static & staticfiles)
c. Application Layer
• WSGI/ASGI Server (Gunicorn/Uvicorn) invoking Django via devsearch/wsgi.py or devsearch/asgi.py
• Django Project (“devsearch” settings, URL routing)
• Django Apps:
– users (authentication, profiles, messaging)
– projects (project CRUD, ratings, search utilities)
– api (serializers, viewsets, URLs for REST endpoints)
d. Persistence Layer
• PostgreSQL Database (prod) or SQLite (db.sqlite3 in dev)
• File storage for user-uploaded media (e.g., project images) – could be S3 or local MEDIA_ROOT
e. External Services (optional based on env)
• Email Service (password reset workflows)
• Monitoring/Logging (e.g., Sentry, Heroku logs)
Interactions & Data Flows
• User loads login.html or any server-rendered template → request hits Heroku Router → Gunicorn → Django view → Query Database → Render HTML + static references → Response to Browser.
• In-page JS (e.g., main.js, login.js) calls /api/… endpoints → JSON responses from DRF viewsets → UI updates.
• Static URLs (/static/… or /staticfiles/…) served by CDN or directly by WhiteNoise.
• Forms (project_form, message_form) post back to Django views in the appropriate app, which validate via forms.py, update models, then redirect or re-render.
Architectural Patterns & Principles
• MVT (Model-View-Template) for server-rendered pages
• RESTful resource routing for the API
• Single monolithic deployment unit, but logically separated apps
• Separation of concerns: authentication/messages vs. project CRUD vs. API layer