-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathapp.py
More file actions
37 lines (31 loc) · 1.2 KB
/
app.py
File metadata and controls
37 lines (31 loc) · 1.2 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
from flask import Flask
from models import db
from cgi.cgi import cgi_blueprint
from thegateway import thegateway_blueprint
from werkzeug.serving import WSGIRequestHandler
from channel_static.main import channel_static_blueprint
from flask_migrate import Migrate
import config
import ssl
app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = config.db_url
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config["SECRET_KEY"] = config.secret_key
app.config["OIDC_CLIENT_SECRETS"] = config.oidc_client_secrets_json
app.config["OIDC_SCOPES"] = "openid profile"
app.config["OIDC_OVERWRITE_REDIRECT_URI"] = config.oidc_redirect_uri
db.init_app(app)
migrate = Migrate(app, db)
app.register_blueprint(cgi_blueprint)
app.register_blueprint(thegateway_blueprint)
app.register_blueprint(channel_static_blueprint)
with app.app_context():
# Ensure our database is present.
db.create_all()
db.configure_mappers()
if __name__ == "__main__":
WSGIRequestHandler.protocol_version = "HTTP/1.1"
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1)
context.set_ciphers("ALL:@SECLEVEL=0")
context.load_cert_chain("server.pem", "server.key")
app.run(host="::", port=443, ssl_context=context, debug=config.debug)