From 274efc3ec73e2bcfee9cd93b26f737ee68fd4638 Mon Sep 17 00:00:00 2001 From: kosayoda Date: Fri, 14 May 2021 13:58:56 +0800 Subject: Merge branch main into dewikification --- manage.py | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'manage.py') diff --git a/manage.py b/manage.py index d4748a3a..71af23c4 100755 --- a/manage.py +++ b/manage.py @@ -10,7 +10,6 @@ import django from django.contrib.auth import get_user_model from django.core.management import call_command, execute_from_command_line - DEFAULT_ENVS = { "DJANGO_SETTINGS_MODULE": "pydis_site.settings", "SUPER_USERNAME": "admin", @@ -156,10 +155,25 @@ class SiteManager: call_command("runserver", "0.0.0.0:8000") return - import pyuwsgi - - # Run uwsgi for production server - pyuwsgi.run(["--ini", "docker/uwsgi.ini"]) + # Import gunicorn only if we aren't in debug mode. + import gunicorn.app.wsgiapp + + # Patch the arguments for gunicorn + sys.argv = [ + "gunicorn", + "--preload", + "-b", "0.0.0.0:8000", + "pydis_site.wsgi:application", + "--threads", "8", + "-w", "2", + "--max-requests", "1000", + "--max-requests-jitter", "50", + "--statsd-host", "graphite.default.svc.cluster.local:8125", + "--statsd-prefix", "site", + ] + + # Run gunicorn for the production server. + gunicorn.app.wsgiapp.run() def main() -> None: -- cgit v1.2.3