Command line tool for the Python Flask web framework

Command line tool for the Python Flask web framework

Command line tool. Note this post has been updated at 06 Jan 2014 to notice about a follow up article. You can read about a follow up article containing an example Flask application made with Flask command line tool.

Command line tool for the Python Flask web framework
Command line tool for the Python Flask web framework

Command line tool for the Python Flask web framework

Note this post has been updated at 03 Jan 2014 to reflect some changes made in the command line tool and more specifically to the resulting layout, see the screenshots session No 4.

Although this is not a post about Flask framework itself and I am not the best to introduce it to you because probably you already know much more things from me; i feel that at least must give two lines of information for potential Flask newcomers.

Flask is a modular micro web framework written in Python, easy to start but also powerful enough to let you create serious web applications. Contrary to Django which is very good and the norm among Python web developers, Flask is minimalistic leaving out the object relation mapper and other goodies. You can get them in the form of extensions (called blueprints in Flask world). For example you can integrate an object relation mapper for SQLAlchemy (Flask-SQLAlchemy), WTForms (Flask-WTF) for user input through HTML forms and many more. For further information check the links bellow.

So this post is about a command line tool (i call it Flaskapp and lives in my home folder ~/bin as flask so i can invoke it from the console easily) that uses Flask and many of the offered extensions and can be used to save the developer from boilerplate code and typing. I created the tool while reading about Flask here.

The short version describes what the tool can do and what it needs in order to do its thing. For more details check the links bellow:

What it does

Creates directory structures for new Flask based projects
Follows a modular approach in Flask based applications, that is all views, models, forms live inside Blueprints created by the tool
Creates blueprints, views, models, templates, forms and a tests ready for use.
Upon project creation it can download and register in the base template jQuery and Bootstrap (both are optional))
Creates configuration files for Nginx and uWSGI ready to be copied to /etc/ configuration directories enabling you instant deployment to servers
Logging ready

A bit of the Ruby on Rails command line tool and its generators but don’t expect refined approach.

Requirements, you must have the following Python packages installed

Requests [] pip install requests
Flask [] pip install flask
Jinja2 [] installed with Flask
Werkzeug [] installed with Flask
SQLAlchemy [] pip install sqlalchemy
flask-SQLAlchemy [] pip install flask-sqlalchemy
WTForms [] pip install wtforms
flask-WTF [] pip install Flask-WTF


Project’s page:
Flask framework:
Jinja2 the template engine used in Flask:
Werkzeug the WSGI library used in Flask:
Requests is an HTTP library easy to use:
SQLAlchemy is an Object Relational Mapper (ORM) for the Python language:
Flask-SQLAlchemy is a Flask extension providing integration with SQLAlchemy:
WTForms is a form creation – validation library for Python:
Flask-WTF is a Flask extension providing integration with WTForms:

Interest Posts

Please help us spread this information to as many people as possible. All you have to do is click on one of the buttons above. We thank you in advance for your great help.

Thanks for sharing


Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *


We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept”, you consent to the use of ALL the cookies. Do not sell my personal information. More Info