diff options
author | 2020-11-14 23:58:45 +0100 | |
---|---|---|
committer | 2020-11-14 23:58:45 +0100 | |
commit | 04764a706a80ca40919bb149860a57a868ea6737 (patch) | |
tree | 5bf6382b77f371c134f9eb00dbdd31b36f690bc2 /manage.py | |
parent | Add Notion to sponsors (diff) | |
parent | Don't call gunicorn using os.system, patch sys.argv and call the module (diff) |
Merge pull request #422 from python-discord/get_rid_of_uwsgi
Get rid of UWSGI, replace with gunicorn
Diffstat (limited to 'manage.py')
-rwxr-xr-x | manage.py | 18 |
1 files changed, 13 insertions, 5 deletions
@@ -7,10 +7,10 @@ import time from typing import List import django +import gunicorn.app.wsgiapp 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 +156,18 @@ class SiteManager: call_command("runserver", "0.0.0.0:8000") return - import pyuwsgi - - # Run uwsgi for production server - pyuwsgi.run(["--ini", "docker/uwsgi.ini"]) + # Patch the arguments for gunicorn + sys.argv = [ + "gunicorn", + "--preload", + "-b", "0.0.0.0:8000", + "pydis_site.wsgi:application", + "--threads", "8", + "-w", "4" + ] + + # Run gunicorn for the production server. + gunicorn.app.wsgiapp.run() def main() -> None: |