Reputation: 1760
I have a django app I want to migrate to dotcloud. Many actions in Django internals and in my app are not asynchronous, i.e. they block the thread until they finish. When I was using Apache, that didn't pose a problem since a different thread is opened on every request. But it doesn't seem to be the case in nginx/uwsgi that dotcloud use. Seemingly, uwsgi has a --enable-threads and --threads options that can be used for multithreading, but:
Upvotes: 1
Views: 419
Reputation: 735
I came here looking for some leads, which I found, thanks! There was a fair amount of leg work left to actually get stuff working, though.
Here is an example app on github that uses gunicorn, gevent, and socketio on dotcloud:
https://github.com/t1m0thy/django-tictactoe/tree/dotcloud
Upvotes: 1
Reputation: 15511
You could run Django with Gunicorn. Gunicorn, in turn, supports multiple worker classes, and people reported success running gunicorn+gevents+django together[1][2].
To use that on dotCloud, you will probably have to use dotCloud's custom service. If that's something that you want to try, I would personally start with dotCloud's reimplementation of python service using the custom service, and replace uwsgi with gunicorn in it.
Upvotes: 1
Reputation: 807
Threads is a problem in python - GIL doesn't allow them to run simultaneously. So multiprocessing is an answer.
Or you may take a look at gevent. Actually gevent is a kind of a hack (monkey patching of python stack) and so on, but it allows to launch green threads. I'm not sure if gevent can be combined with django, but google knows ;)
Upvotes: -1