Skip to main content

Start a Flask project in a Application Factory Pattern

Project description

Start Flask

Start a new Flask project on the application factory model.

How to use

  1. Update the pip in your virtual environment:
$ pip install --upgrade pip
  1. Install start_flask package:
$ pip install -i https://test.pypi.org/simple/ start-flask
  1. Create your new projects:
$ start_flask project_name [options]
or
$ start_flask [options] project_name

IMPORTANT

  • Do not use spaces in your project name. Prefer underscores instead spaces.
  • The --afp option indicates that you want to create a new Flask project on Application Factory Pattern.
  • The --venv option indicates that you want to create a virtual environment. It will be created inside the project's root folder as .venv.
  • The --sqlal option indicates that you want to install Flask SQLAlchemy in your project.
  • The --dyna option indicates that you want to install Dynaconf in your project.
  • The --all option indicates that you want to install all options (afp + venv + sqlal).
  • If you chose the Application Factory Pattern (--afp), don't forget to update the FLASK_APP environment variable:
$ export FLASK_APP=project_name/app.py
  • If you want to run flask in development mode, update the FLASK_ENV environment variable:
$ export FLASK_ENV=development
  • if you are using the Application Factory Pattern and want to use the flask-toolbar, run the command:
$ pip install flask-toolbar

and uncomment the line:
# toolbar.init_app(app) at app.py file or
# "project_name.ext.toolbar:init_app" in settings.toml (when you are using Dynaconf)


In the Makefile file, we have some useful commands, which we use with the make command, such as:

command what he does
make clean clears the project folder
make install install our project as a package python
make install-dev similar to install, but with requirements-dev.txt
make test run tests
make init-db starts and updates the db (if you choose --sqlal)
make format formats the files (needs: isort and black)


This python script was created by Cesar and Jady Godoi during Curso de Desenvolvimento Web taught by Bruno Rocha.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

start_flask-0.1.11.tar.gz (23.6 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page