Home / File/ __init__.py — flask Source File

__init__.py — flask Source File

Architecture documentation for __init__.py, a python file in the flask codebase. 3 imports, 0 dependents.

File python ApplicationCore AppLifeCycle 3 imports 2 functions 1 classes

Entity Profile

Dependency Diagram

graph LR
  dcac1a9c_6e3e_f729_b62b_f00e50c7a9fb["__init__.py"]
  af26f920_cda7_8be3_b478_7468fb1b1606["af26f920:cda7:8be3:b478:7468fb1b1606"]
  dcac1a9c_6e3e_f729_b62b_f00e50c7a9fb --> af26f920_cda7_8be3_b478_7468fb1b1606
  14129390_0281_6bfd_c9e4_d05e966d2c95["celery"]
  dcac1a9c_6e3e_f729_b62b_f00e50c7a9fb --> 14129390_0281_6bfd_c9e4_d05e966d2c95
  8c762fc5_c0b6_0d4d_3889_896d80fbf225["flask"]
  dcac1a9c_6e3e_f729_b62b_f00e50c7a9fb --> 8c762fc5_c0b6_0d4d_3889_896d80fbf225
  style dcac1a9c_6e3e_f729_b62b_f00e50c7a9fb fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

from celery import Celery
from celery import Task
from flask import Flask
from flask import render_template


def create_app() -> Flask:
    app = Flask(__name__)
    app.config.from_mapping(
        CELERY=dict(
            broker_url="redis://localhost",
            result_backend="redis://localhost",
            task_ignore_result=True,
        ),
    )
    app.config.from_prefixed_env()
    celery_init_app(app)

    @app.route("/")
    def index() -> str:
        return render_template("index.html")

    from . import views

    app.register_blueprint(views.bp)
    return app


def celery_init_app(app: Flask) -> Celery:
    class FlaskTask(Task):
        def __call__(self, *args: object, **kwargs: object) -> object:
            with app.app_context():
                return self.run(*args, **kwargs)

    celery_app = Celery(app.name, task_cls=FlaskTask)
    celery_app.config_from_object(app.config["CELERY"])
    celery_app.set_default()
    app.extensions["celery"] = celery_app
    return celery_app

Subdomains

Classes

Dependencies

  • af26f920:cda7:8be3:b478:7468fb1b1606
  • celery
  • flask

Frequently Asked Questions

What does __init__.py do?
__init__.py is a source file in the flask codebase, written in python. It belongs to the ApplicationCore domain, AppLifeCycle subdomain.
What functions are defined in __init__.py?
__init__.py defines 2 function(s): celery_init_app, create_app.
What does __init__.py depend on?
__init__.py imports 3 module(s): af26f920:cda7:8be3:b478:7468fb1b1606, celery, flask.
Where is __init__.py in the architecture?
__init__.py is located at examples/celery/src/task_app/__init__.py (domain: ApplicationCore, subdomain: AppLifeCycle, directory: examples/celery/src/task_app).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free