63 lines
1.3 KiB
Markdown
63 lines
1.3 KiB
Markdown

|
|
|
|
# Quart-Imp
|
|
|
|
[](https://pypi.org/project/quart-imp/)
|
|
[](https://raw.githubusercontent.com/CheeseCake87/flask-imp/master/LICENSE)
|
|

|
|
|
|
`pip install quart-imp`
|
|
|
|
## What is Quart-Imp?
|
|
|
|
Quart-Imp's main purpose is to help simplify the importing of blueprints, and resources.
|
|
It has a few extra features built in to help with securing pages and password authentication.
|
|
|
|
## Generate a Quart app
|
|
|
|
```bash
|
|
quart-imp init
|
|
```
|
|
|
|
## Example
|
|
|
|
```text
|
|
project/
|
|
└── app/
|
|
├── blueprints/
|
|
│ └── www/...
|
|
├── extensions/
|
|
│ └── __init__.py
|
|
├── resources/
|
|
│ ├── static/...
|
|
│ ├── templates/...
|
|
│ └── routes.py
|
|
└── __init__.py
|
|
```
|
|
|
|
`# app/extensions/__init__.py`
|
|
|
|
```python
|
|
from quart_imp import Imp
|
|
|
|
imp = Imp()
|
|
```
|
|
|
|
`# app/__init__.py`
|
|
|
|
```python
|
|
from quart import Quart
|
|
|
|
from app.extensions import imp
|
|
|
|
|
|
def create_app():
|
|
app = Quart(__name__, static_url_path="/")
|
|
|
|
imp.init_app(app)
|
|
imp.import_app_resources()
|
|
imp.import_blueprints("blueprints")
|
|
|
|
return app
|
|
```
|