Nginx [SOLVED]: Python for Web, do I need nginx/apache..

Nginx [SOLVED]: Python for Web, do I need nginx/apache..

Home Forums Nginx Nginx [SOLVED]: Python for Web, do I need nginx/apache..

Tagged: , ,

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #36711



    I’m making a web application for trading based on python (FLASK) and nodejs. Is it critical to use webserver (nginx in my case) for python?

    Currently im using webserver only for images and files and running it on subdomain at port 80, and using main domain for python. Could it work ? If not why do I need to use webserver?




    Accepted AnswerAnswer

    Why should you use a webserver instead of Flask’s built in web server:

    1. It is not as efficient as a standalone one as it runs in a thread alongside the workers and they compete for CPU time inside a single process.
    2. It’s also very inflexible and doesn’t let you adjust the interfaces:workers ratio, which is how you can tune performance (based on if your site has a high number of open connections versus a high number of requests per second).
    3. The development server could just fail outright. It is not designed to be used as a long-running process (days, weeks, months), and so it has not been well tested to work in this capacity.
    4. If you are concerned at ALL about security (and not just the security of the data in the application itself, but the security of the box that will be running it as well) then you should not use the development server. It is not ready to withstand any sort of attack.

    Here’s an example of how you can configure an nginx server for your Flask application.

    Author: Sourav Badami
    Creative Commons License
    This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.