Initialising a Flask-Imp Project

Flask-Imp has a cli command that deploys a new ready-to-go project. This project is structured in a way to give you the best idea of how to use Flask-Imp.

flask-imp init --help

Create a new project

Make sure you are in the virtual environment, and at the root of your project folder, then run the following command:

flask-imp init

After running this command, you will be prompted to choose what type of app you want to deploy:

~ $ flask-imp init
What type of app would you like to create? (minimal, slim, full) [minimal]:

See below for the differences between the app types.

After this, you will be prompted to enter a name for your app:

~ $ flask-imp init
...
What would you like to call your app? [app]:

‘app’ is the default name, so if you just press enter, your app will be called ‘app’. You will then see this output:

~ FILES CREATED WILL LOOP OUT HERE ~

===================
Flask app deployed!
===================

Your app has the default name of 'app'
Flask will automatically look for this!
Run: flask run --debug

If you called your app something other than ‘app’, like ‘new’ for example, you will see:

~ FILES CREATED WILL LOOP OUT HERE ~

===================
Flask app deployed!
===================

Your app has the name of 'new'
Run: flask --app new run --debug

As you can see from the output, it gives you instructions on how to start your app, depending on the name you gave it.

You should see a new folder that has been given the name you specified in the flask-imp init command.

Additional options

You can also specify a name for your app in the command itself, like so:

flask-imp init -n my_app

This will create a new app called ‘my_app’. The default will be a minimal app, this has no blueprints or database models.

You can also deploy a slim app, that will have one blueprint and no database models, like so:

flask-imp init -n my_app --slim

You can also deploy a full app that is setup for multiple blueprints and database models, like so:

flask-imp init -n my_app --full

init Folder structures

Minimal app (default)

flask-imp init --minimal:

app/
├── resources
│   └── routes.py
│
├── static
│   └── css
│       └── water.css
├── templates
│   └── index.html
│
├── __init__.py
├── config.py
├── extensions.py
└── globals.py

Slim app

flask-imp init --slim:

app/
├── extensions
│   └── __init__.py
│
├── resources
│   ├── cli
│   │   └── cli.py
│   └── error_handlers
│       └── error_handlers.py
│
├── www
│   ├── resources
│   │   └── index.py
│   ├── static
│   │   ├── css
│   │   │   └── water.css
│   │   └── js
│   │       └── main.js
│   ├── templates
│   │   └── www
│   │       ├── extends
│   │       │   └── main.html
│   │       ├── includes
│   │       │   ├── footer.html
│   │       │   └── header.html
│   │       └── index.html
│   └── __init__.py
│
├── static
├── templates
│   └── error.html
│
├── __init__.py
├── config.py
├── extensions.py
└── globals.py

Full app

flask-imp init --full:

app/
├── blueprints
│   └── www
│       ├── resources
│       │   └── index.py
│       ├── static
│       │   ├── css
│       │   │   └── water.css
│       │   └── js
│       │       └── main.js
│       ├── templates
│       │   └── www
│       │       ├── extends
│       │       │   └── main.html
│       │       ├── includes
│       │       │   ├── footer.html
│       │       │   └── header.html
│       │       └── index.html
│       └── __init__.py
│
├── extensions
│   └── __init__.py
│
├── models
│   └── example_user_table.py
│
├── resources
│   ├── cli
│   │   └── cli.py
│   ├── context_processors
│   │   └── context_processors.py
│   ├── error_handlers
│   │   └── error_handlers.py
│   ├── filters
│   │   └── filters.py
│   └── routes
│       └── routes.py
│
├── static
├── templates
│   └── error.html
│
├── __init__.py
├── config.py
├── extensions.py
└── globals.py