Files
3cloud-backend/api_server.py
T
2025-02-09 17:21:32 +00:00

26 lines
796 B
Python

"""
Entry point for running the Flask application.
"""
import os
from app import app, db
def setup_database():
"""
Set up the database by creating all tables and initializing with default data.
"""
print("Running setup database")
with app.app_context():
db.create_all() # Create database tables based on models
if __name__ == '__main__':
with app.app_context():
# Only run this function on initial start, don't run when the Flask debugger restarts
if os.environ.get('WERKZEUG_RUN_MAIN') != 'true':
# Set up the database before starting the app
setup_database()
# session.permanent = True
# app.permanent_session_lifetime = timedelta(minutes=5)
app.run(debug=True, port=5000, host="0.0.0.0")