5 ms·
Django is a better monolithic framework. But in Python world users will be equally productive with any WSGI or ASGI based framework. With Django 3.0 alpha ther
by dragonsh 7y ago
Django is a better monolithic framework. But in Python world users will be equally productive with any WSGI or ASGI based framework.
With Django 3.0 alpha there is an issue with orm which is still not async, so not sure how mixing async code with sync code will behave.
Personally I haven't moved to any async framework in Python for project which need db access until the database adapters like psycopg and orm like sqlalchemy support them completely.
Now a days since most of my startup work involves developing REST API using Python backend without worrying about templates prefer micro framework like Flask [1], bottle [2], web.py [3], Pyramid [4], TurboGears 2 [5], cherrypy [6] etc.
For async might use uvloop based micro framework like sanic [7], quart [8], or starlette [9] vibora [10] etc.
These days in development we try to use these framework more like a library than framework per se. The difference is using them as library our code call library code and it's inline with one of the zen of python "Explicit is better than implicit".
[1] https://palletsprojects.com/p/flask/ https://palletsprojects.com/p/flask/
[2] https://bottlepy.org/ https://bottlepy.org/
[3] http://webpy.org/ http://webpy.org/
[4] https://trypyramid.com/ https://trypyramid.com/
[5] https://turbogears.org/ https://turbogears.org/
[6] https://cherrypy.org/ https://cherrypy.org/
[7] https://github.com/huge-success/sanic https://github.com/huge-success/sanic
[8] https://pgjones.gitlab.io/quart/ https://pgjones.gitlab.io/quart/
[9] https://www.starlette.io/ https://www.starlette.io/
[10] https://vibora.io/ https://vibora.io/
- collinmanderson 7y ago> so not sure mixing async code with sync code will behave. I believe there are safeguards in place to be sure you don't accidentally do this.
- dragonsh 7y agoIt will trigger an error to review the code. It still is bit of a trouble to debug async code with sync code. "Note that as a side-effect of this change, Django is now aware of asynchronous event loops and will block you calling code marked as “async unsafe” - such as ORM operations - from an asynchronous context. If you were using Django from async code before, this may trigger if you were doing it incorrectly. If you see a SynchronousOnlyOperation error, then closely examine your code and move any database operations to be in a synchronous child thread."
- dplgk 7y agoWhat is a good use case for async in python? I absolutely loathe the async nature of javascript and find code much harder to follow.