moved everything to a new module called backend
This commit is contained in:
41
backend/__main__.py
Normal file
41
backend/__main__.py
Normal file
@@ -0,0 +1,41 @@
|
||||
#!/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
|
||||
from backend.models import pre_fill_table
|
||||
from backend.tools.model_updater import update_recorder_models_database
|
||||
|
||||
|
||||
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)
|
||||
|
||||
pre_fill_table()
|
||||
update_recorder_models_database()
|
||||
|
||||
|
||||
app.run(debug=True, host="0.0.0.0")
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user