uWSGI Server

2.0.31 · maintenance · verified Sat Apr 11

uWSGI is an open-source, fast, and self-healing application server container that serves as a full stack for building hosting services. It is primarily known for efficiently running Python WSGI applications but supports various other languages and protocols (like Ruby/Rack, Perl/PSGI, PHP, Go) through its pluggable architecture. The current stable version is 2.0.31. The project has been in maintenance mode since October 2022, focusing on stability rather than new features.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates how to create a basic WSGI 'Hello World' application and run it using the `uwsgi` command-line tool. The `--http` option binds to an HTTP port, `--wsgi-file` specifies your application file, `--callable` points to the WSGI callable, and `--processes`/`--threads` configure concurrency.

import os

def application(environ, start_response):
    status = '200 OK'
    headers = [('Content-type', 'text/plain')]
    start_response(status, headers)
    return [b"Hello from uWSGI and Python!"]

# To run: save this as `wsgi_app.py`
# Then execute from your terminal:
# uwsgi --http :9090 --wsgi-file wsgi_app.py --callable application --processes 1 --threads 1

view raw JSON →