Skip to content
Flask CLI build/dev tool for generating API entities and bundling static sites into Flask apps
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


Build tool Command line interface (CLI) for Flask for tasks including:

- Generate Flask resources such as Dockerfiles, blueprints, or even entire applications
- Bundle and serve static web applications such as Angular or React with python APIs through a single, combined Flask app


Simple, pip install flaskerize


Create a new React + Flask project with Flaskerize

Make a new react project and build into a static site:

create-react-app test

cd test

yarn build --prod

cd ..

Generate a new Flask app with flaskerize

fz g app

Bundle the new React and Flask apps together:

fz b -from test/build/ -to app:create_app

Run the resulting app:


The app will now be available on http:localhost:5000/!

Generate a basic Flask app

Generating a basic Flask app is simple:

flaskerize generate hello-world

Or the shorthand:

fz g hw

The first argument after the generate flag is the type of application you want to create (see available types, and the following argument is the name of the application.

Create new React app

create-react-app test

cd test

yarn build --prod

cd ..

To view the production React app as-is (no Flask), you can use serve (you'll need to install it globally first yarn global add serve)

serve -s test/build/

The app will now be available on http:localhost:5000/

Now, to serve this from a new Flask app with flaskerize, run the following

flaskerize generate app -from test/build/

This command will generate a file containing the Flask app, which can then be run with python

The Flask-ready version of your React app can now be viewed at http:localhost:5000/!

Create new Angular app

ng new

cd <project name>

yarn build --prod

flaskerize generate app -from dist/<project name>/

This command will generate a file containing the Flask app, which can then be run with python

The Flask-ready version of your Angular app can now be viewed at http:localhost:5000/!

Attach site to an existing Flask app

Flaskerize uses the factory pattern exclusively. If you're existing application does not follow this, see Factory pattern

Attach with one command and generate Dockerfile

fz b -from test/build/ -to app:create_app --with-dockerfile

Or, longer flaskerize bundle -from test/build/ -to app:create_app --with-dockerfile

Separate generation and attachment

First, create a blueprint from the static site

fz g bp -from test/build/

Next, attach the blueprint to your existing Flask app

fz a -to

You can also use the longer form of both of these commands:

flaskerize generate blueprint --static-dir-name test/build/

flaskerize attach -to app:create_app

Generate a new namespace

Usage: fz g ns <basename> Namespace generation will create a new file containing a: - Class - Marshmallow Schema - Flask-RESTplus Resource

The basename argument is used to determine the name of the classes and a default filename unless one is specified with the -o flag. By default, a test is also generated using the same filename as the resource except ending in The generated tests using pytest and assume (currently) that you have followed the best practice of creating a tests/ file within the app that contains pytest fixtures for generating an app, client, etc. For example, this might simply be

# app/test/

import pytest

from app import create_app

def app():
    return create_app('test')

def client(app):
    return app.test_client()

Note: The test files for the code itself are always placed alongside the code itself. For example, the test for api/ should be api/ The tests/ folder is for application-wide testing utilities and, although you can place tests here and they will correctly be detected and run, it is not advised. It is better to localize all code related to the same concept. If you are doubting whether you are putting code into the right place, always ask yourself "How long would it take me to delete this feature entirely from the code?". If the answer is "five seconds because I just delete the app/doodad folder, then you are probably doing this right."

Example: fz g ns product --dry-run

Factory Pattern


Available application types

- hello-world (hw): A basic hello world app. Args: [app_name -> name of the app]
You can’t perform that action at this time.