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.4.tar.gz
(4.6 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.4.tar.gz.
File metadata
- Download URL: flask-sub-apps-0.1.4.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.1 CPython/3.8.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
952aa4c93dc861be936f633d449ccb04084142db612168a39aa58d5de15a2326
|
|
| MD5 |
f9d0508bfbb5cb5c1dcea3f615501f97
|
|
| BLAKE2b-256 |
8ae3d443d348ece817744127334f492502c8224c0d471edab6a2f82faa7641b9
|
File details
Details for the file flask_sub_apps-0.1.4-py3-none-any.whl.
File metadata
- Download URL: flask_sub_apps-0.1.4-py3-none-any.whl
- Upload date:
- Size: 7.3 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 |
faea421752aaef6a38a6cfafd1072cc5aef30e25e6e896cf8da754749eb98aac
|
|
| MD5 |
8ebb7a83d5463e065c15d1447fad2671
|
|
| BLAKE2b-256 |
6c2837fdf3d4ff3727ff8481b9adb1cba16cb945ac389088b8a2f981620c22ff
|