Run with gunicorn instead
This commit is contained in:
parent
48ba45463f
commit
db5355164c
3 changed files with 5 additions and 44 deletions
|
|
@ -1 +1,2 @@
|
|||
psycopg
|
||||
gunicorn
|
||||
|
|
|
|||
|
|
@ -1,5 +1,9 @@
|
|||
# This file was autogenerated by uv via the following command:
|
||||
# uv pip compile requirements/production.in
|
||||
gunicorn==22.0.0
|
||||
# via -r requirements/production.in
|
||||
packaging==24.1
|
||||
# via gunicorn
|
||||
psycopg==3.1.19
|
||||
# via -r requirements/production.in
|
||||
typing-extensions==4.12.2
|
||||
|
|
|
|||
|
|
@ -1,44 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import bjoern
|
||||
import os
|
||||
import socket
|
||||
import traceback
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings.production")
|
||||
app = get_wsgi_application()
|
||||
|
||||
NUM_WORKERS = 1
|
||||
worker_pids = []
|
||||
|
||||
socket_path = "/var/run/reinheit/reinheit.sock"
|
||||
|
||||
try:
|
||||
os.unlink(socket_path)
|
||||
except OSError:
|
||||
if os.path.exists(socket_path):
|
||||
os.remove(socket_path)
|
||||
|
||||
sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
sock.bind(socket_path)
|
||||
sock.listen()
|
||||
|
||||
print("Setting access mode to 777")
|
||||
os.chmod(socket_path, 0o777)
|
||||
|
||||
|
||||
try:
|
||||
print(f"Serving reinheit via {socket_path}")
|
||||
bjoern.server_run(sock, app)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
try:
|
||||
sock.close()
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
try:
|
||||
os.remove(socket_path)
|
||||
except Exception:
|
||||
traceback.print_exc()
|
||||
Loading…
Add table
Reference in a new issue