Skip to content

Commit

Permalink
Add option for production WSGI server (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
chennin authored Dec 20, 2022
1 parent 3b654bd commit 25f2fa2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ SQLAlchemy==1.4.41
tenacity==8.1.0
tqdm==4.64.1
Werkzeug==2.2.2
waitress==2.1.2
4 changes: 4 additions & 0 deletions stellarisdashboard/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def _get_default_base_output_path():
tab_layout=DEFAULT_TAB_LAYOUT,
market_resources=DEFAULT_MARKET_RESOURCES,
market_fee=DEFAULT_MARKET_FEE,
production=False,
)


Expand Down Expand Up @@ -237,6 +238,8 @@ class Config:
market_resources: List[Dict[str, Any]] = None
market_fee: List[Dict[str, float]] = None

production: bool = False

PATH_KEYS = {
"base_output_path",
"save_file_path",
Expand All @@ -250,6 +253,7 @@ class Config:
"show_all_country_types",
"log_to_file",
"include_id_in_names",
"production",
}
INT_KEYS = {
"port",
Expand Down
6 changes: 5 additions & 1 deletion stellarisdashboard/dashboard_app/graph_ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,11 @@ def start_dash_app(host, port):
timeline_app.css.config.serve_locally = True
timeline_app.scripts.config.serve_locally = True
timeline_app.layout = get_layout()
timeline_app.run_server(host=host, port=port)
if config.CONFIG.production == True:
from waitress import serve
serve(timeline_app.server, host=host, port=port)
else:
timeline_app.run_server(host=host, port=port)


def get_layout():
Expand Down

0 comments on commit 25f2fa2

Please sign in to comment.