python - How to start Django from code in background? -
one can start django using management command this:
management.call_command('runserver', interactive=false)
but blocks execution. workaround apart subprocess/threading/multiprocessing.
i mean how in more native fashion?
a management command not "starting django".
you "start django" deploying on number of web servers, each of has methods run in background. https://docs.djangoproject.com/en/dev/howto/deployment/
dynamically deploying django isn't i've seen, suppose write scripts generate webserver configuration files.
manage.py runserver
should never used production environments / uses.
if example, , want run other asynchronous management commands, accepted community reply to utilize task queue celery.
http://docs.celeryproject.org/en/latest/django/
you fire off 10000 non blocking management commands consumed "in future" @ point celery workers.
python django
No comments:
Post a Comment