27 lines
964 B
Python
27 lines
964 B
Python
"""Application entry-point wrapper.
|
|
|
|
This module keeps the previous API (importing `app`, `db`, `Frage` from
|
|
the top-level `app` module) while delegating the real implementation to
|
|
the `application` package's factory.
|
|
"""
|
|
|
|
from application import create_app
|
|
from application.extensions import db
|
|
from application.models import Adresse, Frage, Antwort
|
|
import os
|
|
|
|
# Create the Flask app using the factory
|
|
app = create_app()
|
|
|
|
|
|
if __name__ == '__main__':
|
|
# In development only: if there is no migrations directory, create tables automatically.
|
|
migrations_dir = os.path.join(app.BASE_DIR, 'migrations')
|
|
if not os.path.exists(migrations_dir):
|
|
app.logger.info('No migrations directory found; creating database tables with db.create_all()')
|
|
with app.app_context():
|
|
db.create_all()
|
|
else:
|
|
app.logger.info('Migrations directory present; please use "flask db upgrade" to update the database schema')
|
|
app.run(debug=True)
|