# Step 3: Installing flaskr with setuptools¶

Flask is now shipped with built-in support for Click. Click provides Flask with enhanced and extensible command line utilities. Later in this tutorial you will see exactly how to extend the flask command line interface (CLI).

A useful pattern to manage a Flask application is to install your app using setuptools. This involves creating a setup.py in the projects root directory. You also need to add an empty __init__.py file to make the flaskr/flaskr directory a package. The code structure at this point should be:

/flaskr
__init__.py
/static
/templates
setup.py


The content of the setup.py file for flaskr is:

from setuptools import setup

setup(
include_package_data=True,
install_requires=[
],
)


When using setuptools, it is also necessary to specify any special files that should be included in your package (in the MANIFEST.in). In this case, the static and templates directories need to be included, as well as the schema. Create the MANIFEST.in and add the following lines:

graft flaskr/templates


At this point you should be able to install the application. As usual, it is recommended to install your Flask application within a virtualenv. With that said, go ahead and install the application with:

pip install --editable .


Note

The above installation command assumes that it is run within the projects root directory, flaskr/. Also, the editable flag allows editing source code without having to reinstall the Flask app each time you make changes.

With that out of the way, you should be able to start up the application. Do this with the following commands:

export FLASK_APP=flaskr.flaskr

(In case you are on Windows you need to use set instead of export). The FLASK_DEBUG flag enables or disables the interactive debugger. Never leave debug mode activated in a production system, because it will allow users to execute code on the server!