aboutsummaryrefslogtreecommitdiffstats
path: root/manage.py
diff options
context:
space:
mode:
authorGravatar kosayoda <[email protected]>2021-05-14 13:58:56 +0800
committerGravatar kosayoda <[email protected]>2021-05-14 14:23:29 +0800
commit274efc3ec73e2bcfee9cd93b26f737ee68fd4638 (patch)
treec74a0fb5cb80b605d21843b8bd424a192198dd8a /manage.py
parentMerge pull request #485 from python-discord/ks129/dewikification/redirection (diff)
Merge branch main into dewikification
Diffstat (limited to 'manage.py')
-rwxr-xr-xmanage.py24
1 files changed, 19 insertions, 5 deletions
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: