move PORT and DEBUG into WebHost config
This commit is contained in:
parent
02f35fcb7f
commit
e6fec46265
|
@ -7,8 +7,6 @@ from waitress import serve
|
||||||
|
|
||||||
from WebHost.models import db, Room, db_session, select
|
from WebHost.models import db, Room, db_session, select
|
||||||
|
|
||||||
DEBUG = False
|
|
||||||
port = 80
|
|
||||||
|
|
||||||
|
|
||||||
def autohost(config: dict):
|
def autohost(config: dict):
|
||||||
|
@ -47,8 +45,8 @@ if __name__ == "__main__":
|
||||||
logging.info(f"Updated config from {configpath}")
|
logging.info(f"Updated config from {configpath}")
|
||||||
db.bind(**app.config["PONY"])
|
db.bind(**app.config["PONY"])
|
||||||
db.generate_mapping(create_tables=True)
|
db.generate_mapping(create_tables=True)
|
||||||
if DEBUG:
|
if app.config["DEBUG"]:
|
||||||
autohost(app.config)
|
autohost(app.config)
|
||||||
app.run(debug=True, port=port)
|
app.run(debug=True, port=app.config["PORT"])
|
||||||
else:
|
else:
|
||||||
serve(app, port=port, threads=app.config["WAITRESS_THREADS"])
|
serve(app, port=app.config["PORT"], threads=app.config["WAITRESS_THREADS"])
|
||||||
|
|
|
@ -26,6 +26,8 @@ def allowed_file(filename):
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
Pony(app)
|
Pony(app)
|
||||||
|
|
||||||
|
app.config["DEBUG"] = False
|
||||||
|
app.config["PORT"] = 80
|
||||||
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER
|
||||||
app.config['MAX_CONTENT_LENGTH'] = 4 * 1024 * 1024 # 4 megabyte limit
|
app.config['MAX_CONTENT_LENGTH'] = 4 * 1024 * 1024 # 4 megabyte limit
|
||||||
# if you want persistent sessions on your server, make sure you make this a constant in your config.yaml
|
# if you want persistent sessions on your server, make sure you make this a constant in your config.yaml
|
||||||
|
|
Loading…
Reference in New Issue