Skip to content

Commit a0c64eb

Browse files
Make gunicorn config environment-agnostic using os.getcwd()
Single config file now works for both production and staging by deriving DIR and proc_name from the working directory. Re-enable copying it in the deploy script since it's safe for all environments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent c0815b0 commit a0c64eb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

config/gunicorn_config.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# Gunicorn configuration file for greynir.is
1+
# Gunicorn configuration file for Greynir
2+
# Works for both production and staging — derives paths from working directory
23

3-
DIR = "/usr/share/nginx/greynir.is/"
4+
import os
5+
6+
DIR = os.getcwd() + "/"
7+
proc_name = os.path.basename(os.getcwd())
48

5-
proc_name = "greynir.is"
69
bind = "unix:" + DIR + "gunicorn.sock"
710
worker_class = "eventlet"
811
workers = 4
@@ -21,9 +24,6 @@
2124

2225
# Remove the Greynir.grammar.bin file to ensure that
2326
# the grammar will be reparsed and a fresh copy generated
24-
25-
import os
26-
2727
try:
2828
os.remove(DIR + "Greynir.grammar.bin")
2929
except OSError:

0 commit comments

Comments
 (0)