How realpython/discover-flask works
Project type and purpose
• This is a full‑stack Flask web application (a learning/tutorial “Discover Flask” app) that demonstrates building a small blog‐style site with user authentication, templates, static assets, database persistence, migrations, and unit tests.
File structure
• Top level:
• run.py / manage.py – application entry points
• config.py – configuration variables (e.g., database URL, secret key)
• db_create.py, db_create_users.py, sql.py – helper scripts for initializing the database
• Procfile, .travis.yml – deployment/CI configuration (Heroku, Travis CI)
• requirements.txt – Python dependencies
• “project/” package:
• project/home/ and project/users/ – two Flask Blueprints (views, forms, templates for public and user areas)
• project/models.py – SQLAlchemy model definitions
• project/static/ – CSS/JS/images served at /static
• project/templates/base.html – shared layout; blueprint templates extend this
• “migrations/” directory – Alembic configuration and versioned migration scripts
• “tests/” directory – unit tests for core functionality, blog posts, and user flows
README for additional insights
• Confirms a tutorial progression: static site → login/auth → databases → migrations → testing → deployment to Heroku.
• Tech stack: Python, Flask microframework, Jinja2 for templating, SQLAlchemy ORM, Flask‑Migrate/Alembic, unit tests with pytest or unittest, deployed on Heroku, CI via Travis.
Elements
• Labels: “Browser,” “Heroku Router,” “WSGI Server,” “Flask App,” “Home Blueprint,” “Users Blueprint,” “SQLAlchemy Models,” “PostgreSQL DB,” “Alembic Migrations,” “Travis CI.”
• Request flow (Browser → Router → WSGI → Flask → DB)
• Response flow (DB → Flask → Browser)
• Trigger flows (Git push → Travis → Heroku)
• Client vs server vs database vs CI/CD