At IDR Solutions we make use of a Open Source Java Application Server to run our free PDF to HTML5 Converter. Having previously written an article on the ‘Top 10 Open Source Java and JavaEE Application Servers‘, I have wondered what other application servers are available for other languages, so I decided to do some research into the Python Language and the application servers that are available.
What is an Application Server?
Firstly what is an Application Server? An application server can often be described as a software framework that resides in the middle tier of a server centric architecture.
The application server can often be viewed as part of a three-tier application, which are a graphical user interface (GUI) server, an application (business logic) server, and a database and transaction server and provide services for security and state maintenance, along with data access and persistence.
For Web applications, an application server will be running in the same environment as its web server(s), and application servers are there to support the construction of dynamic pages and implement services like clustering, fail-over, and load-balancing, so developers can focus on implementing the business logic.
At IDRsolutions we like to describe it to non-technical users as a magic door. It allows you to write code to run on a server and code on a client and allow them to talk to each other. It all just works and handles all the complexity transparently for you.
So now we have established what an Application server is, join me as I guide you through my ‘Top 6 Python Application Servers’.
Django is a free and open source web application framework, which has been written in the Python language, which follows the model–view–controller (MVC) architectural pattern. It is maintained by the non profit Django Software Foundation (DSF) and is available under a 3 clause BSD License and encourages rapid development and clean, pragmatic design.
It lets you build high-performing, web applications quickly with its primary focus on automating as much as possible. Also included in the core framework are is s lightweight and standalone web server for development and testing (includes the ability to launch a FastCGI server, enabling use behind any web server which supports FastCGI, such as Lighttpd or Hiawatha) It is also possible to use other WSGI-compliant web servers like Apache, NGINX using WSGI, Gunicorn, or Cherokee using flup (a Python module).
Interestingly Django may also be run in conjunction with Jython on any Java EE application server such as GlassFish or JBoss. In this case django-jython must be installed in order to provide JDBC drivers for database connectivity.
The Gunicorn “Green Unicorn” is a Python Web Server Gateway Interface HTTP Server for Unix and is able to offer a lot of functionality in a significantly easy to operate fashion for developers.
It is a pre-fork worker model, ported from Ruby’s Unicorn project meaning that a central master process (Gunicorn) manages multiple worker processes (of differing types), which then handle and deal with the requests directly. The Gunicorn server is broadly compatible with a number of web application frameworks, simply implemented, light on server resources and fairly fast out of the box.
It comes with native support for WSGI, web2py, Django and Paster, automatic worker process management,simple configuration, multiple worker configurations, server hooks for extensibility and compatible with Python 2.6+ and Python 3.1+ and comes with SSL support.
Python Paste, sometimes also know as paste, is a set of utilities for web development in Python. Paste has been described as “a framework within another framework (web frameworks)” and was originally developed by Ian Bickering.
In terms of the package that comes with Python Paste, there are modules that help in implementing WSGI middleware which includes a WSGI wrapper for CGI applications and also includes a simple web server that can produce WSGI requests. In the future it is the intention that it is separated into more independent packages.
It is available under a MIT License.
Tornado is a scalable, non-blocking web server and application development framework and asynchronous networking library. It was originally developed at FriendFeed (whom were acquired by Facebook in 2009). Tornado is highly scalable and can open many connections, making it ideal for long polling, web sockets, and other applications that require a long-lived connection. It also comes with a WSGI server which other WSGI Python applications (and frameworks) can use to run.
Tornado is open-sourced and available under a Apache 2.0 License
Twisted is an event-driven network programming framework which supports TCP, UDP, SSL/TLS, IP multicast and a large number of protocols (including HTTP, XMPP, NNTP, IMAP, SSH, IRC, and FTP amongst others). There is also support for Unix domain sockets and is licensed under the MIT License.
Twisted comes with a web server that runs on WSGI and it is capable of powering other Python web applications allowing developers to use the servers for custom HTTP serving purposes.
CherryPy is an object-oriented web application framework using the Python programming language and is fully self contained. It has been designed for rapid development of web applications through using wrappers for the HTTP protocol.
CherryPy can be used as a web server or can launch one via any WSGI compatible environment and can do this without being bound to CherryPy’s application development frameworkIt. It does not deal with tasks such as templating for output rendering or back end access. The framework is extensible with filters, can handle static files, support for SSL and is available under a BSD License.
Hopefully you found this guide to Application Servers for Python useful.
IDRsolutions develop a Java PDF library, a PDF forms to HTML5 converter, a PDF to HTML5 or SVG converter and a Java Image Library that doubles as an ImageIO replacement. On the blog our team post about anything interesting they learn about.