What is the best way to run Django on Tornado Web Server to have async + django admin + django orm possibilities?

前端 未结 2 735
不思量自难忘°
不思量自难忘° 2021-02-04 16:34

I would like to have django admin panel with tornado backends, which will process requests from online game. I dont know at the moment, is it a good idea to load django app in t

2条回答
  •  忘了有多久
    2021-02-04 17:07

    Django is not asynchronous, so running Django in Tornado will remove most of the performance benefits you might get from Tornado.

    If you want maximum async performance, you should use Tornado with a non-blocking database (I'm assuming you want Django admin for use with a SQL database).

    If you want maximum ease of development, use Django, with it's ORM system and admin tools.

    You can't just mix the best of both worlds, unfortunately.

    So, yes, you will lose performance. In this situation I would probably use Tornado and give up on Django admin. If you're dead set on a compromise you could write two apps, sharing a database, but that will mean you need to maintain two data access layers.

提交回复
热议问题