Flask package for auto-loading sub-apps
Project description
Flask Sub-Apps
Flask sub-apps are modules that can be installed to a Flask application.
Each sub-app can have its own routes, commands, models, etc. Installing
a sub-app is as simple as passing a string containing a module. The module
will be automatically imported and the appropriate attributes will be installed in the
application.
Here is an example of installing a sub-app::
from flask import Flask
from flask.ext.app import FlaskApp
from myapp import myapp
app = Flask(__name__)
sub_apps = FlaskSubApps(
app,
installed_sub_apps=["path.to.myapp"],
)
app.run()
The above example will install the `myapp` module to the application.
The `myapp` module can then be used as a regular Flask application.
The `installed_sub_apps` parameter is used to specify where to find sub-apps.
It's a list of strings, each string being a path to a sub-app.
By default, files within sub-app will be search by below code::
MODELS_FILE = env.get("FLASK_SUB_APPS_MODELS_FILE", ["models", "sqla_models"])
COMMANDS_FILE = env.get("FLASK_SUB_APPS_COMMANDS_FILE", ["commands", "flask_commands"])
ROUTERS_FILE = env.get(
"FLASK_SUB_APPS_ROUTERS_FILE",
["routers", "views", "api_views", "urls", "blueprints"],
)
# Specify name of the module the application should look for.
# String and array of strings are accepted.
# You can use a module path, relative to root of the sub-app.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
flask-sub-apps-0.1.1.tar.gz
(6.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flask-sub-apps-0.1.1.tar.gz.
File metadata
- Download URL: flask-sub-apps-0.1.1.tar.gz
- Upload date:
- Size: 6.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ca77490a9aa0c4335ff45ed31395f36ce2e1abd972922ae86918132bf38d74e
|
|
| MD5 |
011a80953ea32787a3f805fd888d659a
|
|
| BLAKE2b-256 |
ba7ee57a3afe885b7fd90a8dd323bebf660238503217b9982981ab88415bd8e4
|
File details
Details for the file flask_sub_apps-0.1.1-py3-none-any.whl.
File metadata
- Download URL: flask_sub_apps-0.1.1-py3-none-any.whl
- Upload date:
- Size: 7.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b89997c13cf51e5dd5e3fabddb78f398200a7d32de216a2613ba3c4f64c02860
|
|
| MD5 |
a873004aaa350cf6e76d5dd7f8d4d7cd
|
|
| BLAKE2b-256 |
fce6de4fe408520a62e917f60be26a4db551d766fb683ee3bda56afffa1a70dc
|