Spaces:
Running
Running
Update gunicorn.conf.py
Browse files- gunicorn.conf.py +15 -4
gunicorn.conf.py
CHANGED
@@ -1,10 +1,21 @@
|
|
1 |
-
# gunicorn.conf.py
|
2 |
import os
|
3 |
|
|
|
4 |
worker_class = 'uvicorn.workers.UvicornWorker'
|
5 |
|
6 |
-
# Can
|
|
|
7 |
workers = int(os.environ.get('GUNICORN_WORKERS', '1'))
|
8 |
|
9 |
-
bind = f"0.0.0.0:{os.environ.get('PORT', '7860')}"
|
10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# gunicorn.conf.py (Should be fine as is)
|
2 |
import os
|
3 |
|
4 |
+
# UvicornWorker is correct for ASGI (Starlette)
|
5 |
worker_class = 'uvicorn.workers.UvicornWorker'
|
6 |
|
7 |
+
# Can potentially increase workers if the lifespan init is robust
|
8 |
+
# Start with 1 on free tiers to conserve memory, test with more if needed
|
9 |
workers = int(os.environ.get('GUNICORN_WORKERS', '1'))
|
10 |
|
11 |
+
bind = f"0.0.0.0:{os.environ.get('PORT', '7860')}" # PORT is standard on HF
|
12 |
+
|
13 |
+
# Optional: Increase timeout if startup/requests are slow
|
14 |
+
# timeout = 120
|
15 |
+
|
16 |
+
# Log levels can also be set here, but rely on code/Uvicorn settings first
|
17 |
+
# loglevel = 'info'
|
18 |
+
|
19 |
+
# Point Gunicorn to the ASGI app instance (ensure filename matches)
|
20 |
+
# This is usually done in the command line: gunicorn main:app -c gunicorn.conf.py
|
21 |
+
# No need to set 'app' variable here.
|