Skip to content

Commit 0d793c9

Browse files
authored
Fix running local uvicorn (fixes #103) (#104)
* Do not hardcode worker tmp dir * Fix running local uvicorn (fixes #103)
1 parent 1cdd823 commit 0d793c9

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

bin/gunicorn_conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class GunicornSettings(BaseSettings):
2121
access_log: str = "-"
2222
error_log: str = "-"
2323
workers_per_core: float = 1.0
24+
worker_tmp_dir: str = "/dev/shm"
2425
max_workers: Optional[int]
2526
web_concurrency: Optional[conint(gt=0)]
2627
workers: Optional[int]
@@ -53,7 +54,7 @@ def set_workers(cls, values):
5354
workers = gunicorn_settings.workers
5455
bind = gunicorn_settings.bind
5556
errorlog = gunicorn_settings.error_log
56-
worker_tmp_dir = "/dev/shm"
57+
worker_tmp_dir = gunicorn_settings.worker_tmp_dir
5758
accesslog = gunicorn_settings.access_log
5859
graceful_timeout = gunicorn_settings.graceful_timeout
5960
timeout = gunicorn_settings.timeout

src/app/api.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,5 +141,9 @@ def powered_by_jbi(
141141

142142
if __name__ == "__main__":
143143
uvicorn.run(
144-
"app:app", host=settings.host, port=settings.port, reload=settings.app_reload
144+
"src.app.api:app",
145+
host=settings.host,
146+
port=settings.port,
147+
reload=settings.app_reload,
148+
log_level=settings.log_level,
145149
)

src/app/environment.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class Settings(BaseSettings):
1717
"""The Settings object extracts environment variables for convenience."""
1818

1919
host: str = "0.0.0.0"
20-
port: str = "80"
20+
port: int = 8000
2121
app_reload: bool = True
2222
env: str = "nonprod"
2323

0 commit comments

Comments
 (0)