Вопрос

The case is we've got a big API to build and my team has chosen python as implementation platform. The API doesn't really need any web pages (templating) - just accepting GET/POST requests and responding with xml/json.

The question is: what is the preferred http server to deploy python api for production scale? We're considering django and cherrypy as the framework and they do have built-in servers, but they seem to be more a development tool than a scalable, super-fast production software.

Java has got all servlet/application containers (jboss, tomcat, glassfish, etc.), PHP's got Apache HTTPD and/or Nginx - and how about python?

Это было полезно?

Решение

You probably want to conform to the WSGI, then you don't need to make your implementation tied to a specific HTTP server.

Read more:

Другие советы

If you would like to use python, check Gunicorn and uWSGI. First one is WSGI server, which would work with most of the frameworks. Second is language agnostic, has probably better performance. I would recommend to start with Gunicorn, it is easier to switch from default server, moreover web server (nginx) configuration is easier.

Do not use default web server in production! Werkzeug is also for development.

Which framework to choose for your API server depends on needs, functionality size and time you have to develop it. Django is a safe tool, it handles many security issues, but it might be longer to update the code. Flask development is faster, but you might spend more time on database/ORM/settings configuration.

For simple API I would recommend json-rpc which is easy to use and has Django support. For more complicated API, it might be better to check REST frameworks.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top