-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
50 lines (37 loc) · 1.19 KB
/
app.py
File metadata and controls
50 lines (37 loc) · 1.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# Load environment variables from .env file (needed for gunicorn)
from dotenv import load_dotenv
load_dotenv()
import os
from flask import Flask, render_template
from todo import todo_bp, init_app as init_todo
from todo import db
SITE = {
"WebsiteName": "TodoApp",
"ControllerName": "UTC Sheffield Olympic Legacy Park",
"ControllerAddress": "UTC Sheffield Olympic Legacy Park, 2 Old Hall Road"
+ ", Sheffield, S9 3TU",
"ControllerURL": "https://www.utcsheffield.org.uk/olp/",
}
def create_app(config_overrides=None):
app = Flask(__name__)
app.config['SQLALCHEMY_DATABASE_URI'] = os.getenv(
'DATABASE_URL',
'sqlite:///todo.db'
)
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
if config_overrides:
app.config.update(config_overrides)
# Register blueprints
app.register_blueprint(todo_bp)
@app.context_processor
def inject_dict_for_all_templates():
return {"site": SITE}
@app.route('/privacy')
def privacy():
return render_template('privacy.html')
# Initialize todo module (db and tables)
init_todo(app)
return app
app = create_app()
if __name__ == '__main__':
app.run(debug=True)