Reputation: 14651
The following question is aimed for two use cases.
My question:
Should the WSGI server be installed inside the same virtualenv along the Python WSGI application itself? or;
Should I have the WSGI server installed globally?
I am wondering about WSGI applications (based on frameworks) such as Flask, CherryPy, Pyramid etc. And WSGI servers such as Gunicorn, Waitress etc.
Thank you.
Upvotes: 0
Views: 500
Reputation: 2009
Just go for virtualenv -- different apps with different libs can coexist peacefully; and if it's a single app only, it's still no harder to set up, but leaves you flexibility for the future.
Same applies to native WSGI servers, just install them into virtualenv, it won't hurt the performance.
What WILL hurt it is Python's multithreading because of GIL, so stay away from native threaded servers like Waitress. Use multiprocess servers (or asynchronous, where it makes sense), which, I believe, Gunicorn is. Consider using uWSGI -- it is very powerful, although not native.
Flask, etc are not applications, they are frameworks that let you develop your applications easier by relieving you from a burden of processing basic things like parsing paths, sending appropriate headers, etc. You just need to choose the one that suits your needs better.
Upvotes: 2