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.2.tar.gz (6.4 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.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: flask-sub-apps-0.1.2.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

Hashes for flask-sub-apps-0.1.2.tar.gz
Algorithm Hash digest
SHA256 438bfb9416e4fc457e7b20950a54a4cbf67e750c0bdc6c5cd53bc931be5bab55
MD5 cadbdccc706f3588bce43e68de8608fd
BLAKE2b-256 7cdb6718dfa7748324bfbe74bc9254bada549c233b3cc01d2657838f32b161db

See more details on using hashes here.

File details

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

File metadata

  • Download URL: flask_sub_apps-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.7 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6670d6c382bcf5fffc8edc5c6f104d33f5bddc8981a9c2fcca28463e573ed5da
MD5 07ef00debdf4b8aa42759788e0b7c269
BLAKE2b-256 57a605be9ec50b3be73949ce19e853cf6edf92fa50979032e7441f1bdb225256

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