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 details)

Uploaded Source

File details

Details for the file start_flask-0.1.11.tar.gz.

File metadata

  • Download URL: start_flask-0.1.11.tar.gz
  • Upload date:
  • Size: 23.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/44.0.0 requests-toolbelt/0.9.1 tqdm/4.48.0 CPython/3.8.2

File hashes

Hashes for start_flask-0.1.11.tar.gz
Algorithm Hash digest
SHA256 35c86524b5474302007e831e1c1492c0f6d3801b33b8729ed05a392f59f651cd
MD5 7a9e7bc64fe57f3bb2b5083e613b2dda
BLAKE2b-256 33d5120931ea7dab6e294022fc0dd7a5eb1902d1054d7211b0ccce67f5143769

See more details on using hashes here.

Supported by

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