quart-imp/docs/_md/v1/CLI Commands-quart-imp init.md
David Carmichael bfcc49dd8d feat: docs
2024-08-16 15:09:07 +01:00

4.9 KiB

Menu = CLI Commands/quart-imp init
Title = Initialising a Quart-Imp Project

Quart-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 Quart-Imp.

quart-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:

quart-imp init

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

~ $ quart-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:

~ $ quart-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 ~

===================
Quart app deployed!
===================
 
Your app has the default name of 'app'
Quart will automatically look for this!
Run: quart run --debug

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

~ FILES CREATED WILL LOOP OUT HERE ~

===================
Quart app deployed!
===================

Your app has the name of 'new'
Run: quart --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 quart-imp init command.

Additional options

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

quart-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.

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

quart-imp init -n my_app --slim

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

quart-imp init -n my_app --full

init Folder structures

Minimal app (default)

quart-imp init --minimal:

app/
├── resources
│   ├── static
│   │   ├── css
│   │   │   └── water.css
│   │   ├── img
│   │   │   └── quart-imp-logo.png
│   │   └── favicon.ico
│   ├── templates
│   │   └── index.html
│   └── routes.py
│
└── __init__.py

Slim app

quart-imp init --slim:

app/
├── extensions
│   └── __init__.py
│
├── resources
│   ├── cli
│   │   └── cli.py
│   ├── error_handlers
│   │   └── error_handlers.py
│   ├── static
│   │   ├── css
│   │   │   └── water.css
│   │   ├── img
│   │   │   └── quart-imp-logo.png
│   │   └── favicon.ico
│   └── templates
│       └── error.html
│
├── www
│   ├── __init__.py
│   ├── routes
│   │   └── index.py
│   ├── static
│   │   ├── css
│   │   │   └── water.css
│   │   ├── img
│   │   │   └── quart-imp-logo.png
│   │   └── js
│   │       └── main.js
│   └── templates
│       └── www
│           ├── extends
│           │   └── main.html
│           ├── includes
│           │   ├── footer.html
│           │   └── header.html
│           └── index.html
│
└── __init__.py

Full app

quart-imp init --full:

app/
├── blueprints
│   └── www
│       ├── __init__.py
│       ├── routes
│       │   └── index.py
│       ├── static
│       │   ├── css
│       │   │   └── water.css
│       │   ├── img
│       │   │   └── quart-imp-logo.png
│       │   └── js
│       │       └── main.js
│       └── templates
│           └── www
│               ├── extends
│               │   └── main.html
│               ├── includes
│               │   ├── footer.html
│               │   └── header.html
│               └── index.html
│
├── extensions
│   └── __init__.py
│
├── resources
│   ├── cli
│   │   └── cli.py
│   ├── context_processors
│   │   └── context_processors.py
│   ├── error_handlers
│   │   └── error_handlers.py
│   ├── filters
│   │   └── filters.py
│   ├── routes
│   │   └── routes.py
│   ├── static
│   │   └── favicon.ico
│   └── templates
│       └── error.html
│
└── __init__.py