How do I use Django with the Tornado web server?
相关问题
- Carriage Return (ASCII chr 13) is missing from tex
- Django __str__ returned non-string (type NoneType)
- Using :remote => true with hover event
- Is there a way to play audio on a mobile browser w
- Django & Amazon SES SMTP. Cannot send email
相关文章
- spring boot用ajax发送请求后,请求路径多了controller的路径
- 针对复杂结构的前端页面,如何更好地与后台交互实现动态网页?
- ajax上传图片,偶尔会出现后台保存的图片有错误或者已损坏,请问可能是什么原因造成的?
- 前端 我想知道怎样通过发ajax请求向服务器拿到数据然后分页显示 最好是点击一页就发一次请求
- WebService 启动调试后,能成功调用函数,但断点进不去任何方法
- 接口返回的数据格式如下,请问可以取到level值为2的name数组呢
- 如何通过页面输入账号密码提交给后端
- How to get jQuery.ajax response status?
There's a project called tornado-proxy that would help you. But I would like to recommend that you use Nginx. In the Nginx config you could now use proxy_pass to direct your calls like this:
In real world you would connect Django and some production-ready webserver with WSGI. This demo shows how you can run Tornado (and it's webserver) and Django side by side from one python module serving different URL prefixes: https://github.com/bdarnell/django-tornado-demo. Tornado would block on serving any request directed to Django, though.
UPDATE:
I created a minimal working demo which shows how to use the Tornado web server to run nicely with django:
https://github.com/tamasgal/django-tornado
ORIGINAL POST:
Just a remark: The WSGI application workflow has been changed from 1.6 to 1.7. You have to replace the import
with
and change the application initialisation from
to
This is the modified code from the Moayyad Yaghi's answer:
it's very simple ( especially with django 1.4) .
1 - just build your django project( and apps ) and make sure it works fine.
2- create a new python file at the root folder ( same dir where you used
django-admin.py startproject
)3- then copy the code below , edit the
os.environ['DJANGO_SETTINGS_MODULE']
line, and paste it in that new .py file.Django 1.6+ it should be like this: