37 lines
930 B
Python
37 lines
930 B
Python
#!/usr/bin/env python
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# Copyright (c) 2019. Tobias Kurze
|
|
import logging
|
|
import ssl
|
|
|
|
from jinja2.exceptions import TemplateNotFound
|
|
|
|
from backend import app, db
|
|
|
|
|
|
def main():
|
|
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
|
|
|
print(app.config.get("SERVER_NAME", None))
|
|
server_name = app.config.get("SERVER_NAME", None)
|
|
if server_name is not None and "ubkaps154.ubka.uni-karlsruhe.de" in server_name:
|
|
try:
|
|
context = ssl.SSLContext(ssl.PROTOCOL_TLSv1_2)
|
|
context.load_cert_chain('cert.pem', 'key.pem')
|
|
app.run(debug=True, ssl_context=context, threaded=True)
|
|
except FileNotFoundError:
|
|
app.run(debug=True, threaded=True)
|
|
|
|
try:
|
|
db.create_all()
|
|
except Exception as e:
|
|
logging.CRITICAL(e)
|
|
|
|
|
|
app.run(debug=True)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
main()
|