Initialize the Flask application.
It loads the configuration from the config.py file, initializes the Flask application,
creates the database and the tables, and registers the routes.
create_app(config_class=FlaskConfig)
Initialize the Flask application.
It loads the configuration from the config_class object, initializes the Flask application.
| Parameters: |
-
config_class
(FlaskConfig, default:
FlaskConfig
)
–
|
Source code in wolproxypyweb/__init__.py
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57 | def create_app(config_class=FlaskConfig):
"""Initialize the Flask application.
It loads the configuration from the config_class object, initializes the Flask application.
Args:
config_class (FlaskConfig): The configuration class.
Returns:
app (Flask): The Flask application.
"""
app = Flask(__name__)
app.config.from_object(config_class)
db.init_app(app)
Migrate(app, db)
login.init_app(app)
login.login_view = "auth.login"
login.login_message = "Please log in to access this page."
bootstrap.init_app(app)
from wolproxypyweb.main import bp as main_bp
app.register_blueprint(main_bp)
from wolproxypyweb.auth import bp as auth_bp
app.register_blueprint(auth_bp, url_prefix="/auth")
from wolproxypyweb.admin import bp as admin_bp
app.register_blueprint(admin_bp, url_prefix="/admin")
from wolproxypyweb.errors import bp as errors_bp
app.register_blueprint(errors_bp)
return app
|