[Django]-Testing a Django app in many separate threads

0👍

use uWSGI

pip install uwsgi

Create .ini for your project:

[uwsgi]
# set the http port
http = :8000
# change to django project directory
chdir = /var/www/myapp
# add /var/www to the pythonpath, in this way we can use the project.app format
pythonpath = /var/www
# set the project settings name
env = DJANGO_SETTINGS_MODULE=myapp.settings
# load django
module = django.core.handlers.wsgi:WSGIHandler()

Start it with built-in http server

uwsgi --ini django.ini --async 10

async — number of threads

http://projects.unbit.it/uwsgi/wiki/Quickstart

http://projects.unbit.it/uwsgi/wiki/Doc095

👤Dmitry

-1👍

I’ve recently began delving into django-celery which is an asynchronous task queue for django. It allows you to queue up tasks to run asynchronously so that you don’t have to wait for responses. It’s simple to install and get started and it would allow your application to utilize asynchronous queueing instead of just your test suite.

http://django-celery.readthedocs.org/en/latest/getting-started/index.html

Leave a comment