Πως να χρησιμοποιήσετε το Django με το Gunicorn¶
Gunicorn (“Green Unicorn”) is a pure-Python WSGI server for UNIX. It has no
dependencies and can be installed using pip.
Εγκαθιστώντας τον Gunicorn¶
Install gunicorn by running python -m pip install gunicorn. For more
details, see the gunicorn documentation.
Τρέχοντας το Django στον Gunicorn ως μια γενική WSGI εφαρμογή¶
When Gunicorn is installed, a gunicorn command is available which starts
the Gunicorn server process. The simplest invocation of gunicorn is to pass the
location of a module containing a WSGI application object named
application, which for a typical Django project would look like:
gunicorn myproject.wsgi
Αυτή η εντολή θα ξεκινήσει ένα process το οποίο τρέχει ένα thread που ακούει στην πόρτα 127.0.0.1:8000. Απαιτεί ότι το project σας βρίσκεται στο Python path. Για να βεβαιωθείτε ότι βρίσκεται, απλώς τρέξετε την παραπάνω εντολή καθώς θα βρίσκεστε στον ίδιο φάκελο που βρίσκεται το αρχείο manage.py.
Δείτε στο deployment documentation του Gunicorn για περισσότερες συμβουλές.