__init__.py — flask Source File
Architecture documentation for __init__.py, a python file in the flask codebase. 3 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR 6e447255_b990_e599_2820_9fe2d66cda05["__init__.py"] 73e29d5a_4071_7cf3_0b5f_a60be3a58988["73e29d5a:4071:7cf3:0b5f:a60be3a58988"] 6e447255_b990_e599_2820_9fe2d66cda05 --> 73e29d5a_4071_7cf3_0b5f_a60be3a58988 bdc6911d_da67_3a1f_90cb_90f5e9f0603e["os"] 6e447255_b990_e599_2820_9fe2d66cda05 --> bdc6911d_da67_3a1f_90cb_90f5e9f0603e 8c762fc5_c0b6_0d4d_3889_896d80fbf225["flask"] 6e447255_b990_e599_2820_9fe2d66cda05 --> 8c762fc5_c0b6_0d4d_3889_896d80fbf225 style 6e447255_b990_e599_2820_9fe2d66cda05 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import os
from flask import Flask
def create_app(test_config=None):
"""Create and configure an instance of the Flask application."""
app = Flask(__name__, instance_relative_config=True)
app.config.from_mapping(
# a default secret that should be overridden by instance config
SECRET_KEY="dev",
# store the database in the instance folder
DATABASE=os.path.join(app.instance_path, "flaskr.sqlite"),
)
if test_config is None:
# load the instance config, if it exists, when not testing
app.config.from_pyfile("config.py", silent=True)
else:
# load the test config if passed in
app.config.update(test_config)
# ensure the instance folder exists
os.makedirs(app.instance_path, exist_ok=True)
@app.route("/hello")
def hello():
return "Hello, World!"
# register the database commands
from . import db
db.init_app(app)
# apply the blueprints to the app
from . import auth
from . import blog
app.register_blueprint(auth.bp)
app.register_blueprint(blog.bp)
# make url_for('index') == url_for('blog.index')
# in another app, you might define a separate main index here with
# app.route, while giving the blog blueprint a url_prefix, but for
# the tutorial the blog will be the main index
app.add_url_rule("/", endpoint="index")
return app
Domain
Subdomains
Functions
Dependencies
- 73e29d5a:4071:7cf3:0b5f:a60be3a58988
- flask
- os
Source
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 1 function(s): create_app.
What does __init__.py depend on?
__init__.py imports 3 module(s): 73e29d5a:4071:7cf3:0b5f:a60be3a58988, flask, os.
Where is __init__.py in the architecture?
__init__.py is located at examples/tutorial/flaskr/__init__.py (domain: ApplicationCore, subdomain: AppLifeCycle, directory: examples/tutorial/flaskr).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free