0👍
You can use the -c
command to specify a configuration file (written in python):
http://docs.gunicorn.org/en/latest/configure.html#settings
Since this is a python file, you can from django.conf import settings
and do
workers = settings.GUNICORN_WORKERS
👤Jj.
0👍
Just add:
run_gunicorn --workers=4
You can make the command a unix alias if you want to have the number of workers default to this.
0👍
You’re not supposed to do python manage.py run_gunicorn
.
do gunicorn project_name.wsgi -b 0.0.0.0:8000 -w 10
or do python -m gunicorn project_name.wsgi -b 0.0.0.0:8000 -w 10
if you’re keen on using manage.py
command read this on how to create a custom management command, create when that uses the subprocess
module’s Popen
method to call one of commands i’ve written above
- [Django]-In django, is it possible to have a foreign key defined to some superclass, but having returned the subclass when queried?
- [Django]-Django signals not fired when saving from admin interface
- [Django]-Django: how to map the results of a raw sql query to model instances in admin list view?
- [Django]-Manage.py doesn't pass the argument to the command
- [Django]-Django AllAuth gives SSLError
Source:stackexchange.com