How caio-machado-dev/growup_portodigital_bonsae works
Project type and purpose
• This is a Django-based full-stack web application named “GrowUP Porto Digital – Bonsae.”
• It provides a form interface (in preCorrecao/templates) backed by a SQLite database (db.sqlite3), with client–side scripts under preCorrecao/static/javascript.
File structure
• Top-level “setup” folder: the Django project container (settings.py, urls.py, wsgi.py, asgi.py).
• Top-level “preCorrecao” folder: the primary Django app, with models.py, views.py, admin.py, migrations, static assets, and templates.
• Procfile at root: indicates deployment on a platform like Heroku using a WSGI server.
• requirements.txt: enumerates Python dependencies.
• manage.py: Django CLI entrypoint.
README for technical stack
• Python + Django framework.
• SQLite3 as the development database.
• Heroku (Procfile) for deployment.
• Frontend uses HTML templates, JavaScript modules (adicionarFundamentacao.js, dadosCampos.js, limparCampos.js, sweetAlert.js), and static JSON data (estados-cidades.json).
Main components
a. Client Side
• Web Browser
• Static assets: HTML templates, CSS (if any), JavaScript modules, JSON files
b. Application Server
• Heroku Dyno (or local runserver) hosting a WSGI/ASGI server
• Django core:
• Views (preCorrecao/views.py)
• Models (preCorrecao/models.py)
• Admin interface (preCorrecao/admin.py)
c. Database
• SQLite (db.sqlite3)
d. Deployment & Tooling
• Git (version control)
• Python Virtual Environment .venv
• Procfile → Gunicorn server configuration
Relationships and data flows
• Browser → HTTP Request → WSGI/ASGI Server → Django URL router → View function
• View ↔ Database ORM (CRUD operations on models)
• View → Template renderer → HTML + JavaScript → HTTP Response → Browser
• Browser loads static files (JS, JSON) via static URL endpoints served by Django’s collectstatic or a CDN in production.
Architectural patterns & design principles
• MVC (Model–View–Template variant in Django)
• Separation of concerns:
• Models handle data
• Views process requests and orchestrate data flow
• Templates define presentation
• Static modules handle client-side logic
• One-app structure keeps related code (models, views, templates, static) together.
Elements
• From Browser to Heroku/Gunicorn (HTTP request)
• From Gunicorn to Django URL router (WSGI socket)
• From URL router to View (function call)
• From View to Database (ORM query) and back
• From View to Template renderer (data → HTML) and back
• From Browser to Static asset server (JS/JSON fetch)
• Optional: annotate environment setup (virtualenv, migrations via manage.py migrate).
Final advice
• Real-world deployment: include Heroku dyno, or local dev server if relevant.