WMGZON/app.py

29 lines
763 B
Python

from flask import Flask
from os import environ
from dotenv import load_dotenv
from controllers.web.endpoints import blueprint
'''
Main entrypoint for Flask application.
Initialises any components that are needed at runtime such as the
Database manager...
'''
app: Flask = Flask(__name__)
# Set app secret key to sign session cookies
load_dotenv()
secret_key = environ.get("APPSECRET")
if secret_key is None:
# NO Secret Key set!
print("No app secret set, please set one before deploying in production")
app.secret_key = "DEFAULTKEY"
else:
app.secret_key = secret_key
# Register a blueprint
app.register_blueprint(blueprint)
if __name__ == "__main__":
app.run(debug=True, host="0.0.0.0", port=8080)