Updates galore. Improved folder structure, componentized, and notifications upon completion.
This commit is contained in:
parent
b48784e2ad
commit
7e0502ca40
33 changed files with 3565 additions and 728 deletions
37
app/__init__.py
Normal file
37
app/__init__.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"""
|
||||
app/__init__.py
|
||||
===============
|
||||
Flask application factory.
|
||||
|
||||
Usage
|
||||
-----
|
||||
from app import create_app
|
||||
flask_app = create_app()
|
||||
|
||||
Gunicorn (wsgi.py) calls create_app() once at startup.
|
||||
The dev-server entry point (run.py) does the same.
|
||||
"""
|
||||
|
||||
from flask import Flask
|
||||
|
||||
from .config import BASE_DIR, MEDIA_ROOT
|
||||
from .db import init_db
|
||||
from .routes import register_routes
|
||||
|
||||
|
||||
def create_app() -> Flask:
|
||||
"""
|
||||
Create and return a configured Flask application instance.
|
||||
"""
|
||||
flask_app = Flask(
|
||||
__name__,
|
||||
template_folder=str(BASE_DIR / 'templates'),
|
||||
static_folder=str(BASE_DIR / 'static'),
|
||||
)
|
||||
|
||||
# Initialise the SQLite settings database
|
||||
init_db()
|
||||
|
||||
register_routes(flask_app)
|
||||
|
||||
return flask_app
|
||||
Loading…
Add table
Add a link
Reference in a new issue