How faus14/proyectofinal_curso_python works
Project type and purpose
• This is a full‑stack, server‑rendered web application built with the Django framework.
• Purpose: allow users to register, create and view “posts” about sports activities, and follow/unfollow other users (akin to a mini‑Twitter).
File structure
• Top‑level “post_coder” folder contains:
• social_django/ ← Django project settings (ASGI/WSGI, URLs, settings.py)
• social/ ← the core Django “social” app (models, views, templates, static, forms, migrations)
• db.sqlite3 ← embedded database
• media/ ← uploaded user media (profile pictures, etc.)
• requirements.txt, manage.py
• Static assets under social/static and templates under social/templates/social.
• Signals (post_coder/social/signals.py) hint at event‑driven updates (e.g., auto‑create Profiles).
• Dependencies managed in requirements.txt; virtualenv under venv/.
Key README insights
• Models: Profile, Post, Relationship (follow/unfollow).
• SQLite used for persistence.
• No external APIs or microservices—pure Django MTV (Model‑Template‑View) pattern.
Main components
A. User’s Web Browser (Client)
B. Django Web Server
1) URL Dispatcher (social_django/urls.py + social/urls.py)
2) Views (social/views.py)
3) Templates (social/templates/social/*.html) & Static (CSS under social/static)
4) Forms (social/forms.py)
5) Signals (social/signals.py)
6) ORM Models (social/models.py)
C. Database (SQLite db.sqlite3)
D. Media Storage (filesystem under media/)
E. (Optional) Future External Services (e.g., S3 for media, Redis for caching)
Relationships & interactions
• Browser → HTTP Request → URL Dispatcher → View
• View ↔ ORM Models → Database
• View → Template Renderer → HTML Response → Browser
• Static files (CSS) served either by Django during dev or via a CDN/in web server in prod
• Form submissions (login, register, post creation) flow through Django Forms → Views → Models
• Signals listen to Model events (e.g., creating Profile when User is created)
Architectural patterns & design principles
• MTV (Model‑Template‑View) pattern: clear separation of concerns.
• Layered architecture:
• Presentation layer (templates/static)
• Application layer (views/forms/signals)
• Domain layer (models + ORM)
• Infrastructure layer (DB, media filesystem)
• Single‑app monolith: easy to extend, one Django project with one or more apps.
Details to capture
• The inter‑app interaction (settings.py imports social.urls).
• The path of a user’s “Create Post” flow: Browser → social/post view → form validation → model.save() → DB → redirect to feed.
• Follow/unfollow flow: Browser → relationship view → model update → DB → feed view refresh.