Skip to main content

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.3.tar.gz (6.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flask_sub_apps-0.1.3-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file flask-sub-apps-0.1.3.tar.gz.

File metadata

  • Download URL: flask-sub-apps-0.1.3.tar.gz
  • Upload date:
  • Size: 6.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for flask-sub-apps-0.1.3.tar.gz
Algorithm Hash digest
SHA256 cf179a12352cd71ae3bee59f5c225452e94ddbc89aad014a83b7a4dd9220925e
MD5 2e1711e60b48f4a99bb44ed725dc2eaa
BLAKE2b-256 e9a3c17edfaf3976f95b4eccdb31bac791a99d2e5e575f7c2ed4292e0494e3b9

See more details on using hashes here.

File details

Details for the file flask_sub_apps-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: flask_sub_apps-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 7.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.5

File hashes

Hashes for flask_sub_apps-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d9d00e88edfd9175f60873fcfe27dd34c7604b3e2f56947a645a1bde7741d608
MD5 f62f47c7df5fcb43925f1228d04f9b37
BLAKE2b-256 04b0c561b34b3c282a85fdfbf83de7dfc53d92f5fb851fa5c58a8c2927176f39

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page