2024-01-28 11:59:04 +00:00
|
|
|
from flask import Flask
|
|
|
|
from os import environ
|
2024-02-18 19:22:35 +00:00
|
|
|
from dotenv import load_dotenv
|
2024-01-28 11:59:04 +00:00
|
|
|
from controllers.web.endpoints import blueprint
|
|
|
|
|
|
|
|
'''
|
2024-02-05 19:19:29 +00:00
|
|
|
Main entrypoint for Flask application.
|
|
|
|
Initialises any components that are needed at runtime such as the
|
2024-01-28 11:59:04 +00:00
|
|
|
Database manager...
|
|
|
|
'''
|
|
|
|
|
2024-02-05 19:19:29 +00:00
|
|
|
app: Flask = Flask(__name__)
|
2024-01-28 11:59:04 +00:00
|
|
|
|
|
|
|
# Set app secret key to sign session cookies
|
2024-02-18 19:22:35 +00:00
|
|
|
load_dotenv()
|
2024-01-28 11:59:04 +00:00
|
|
|
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)
|