Skip to main content

Django Lighttpd Middleware

Django is one of the most popular Python web frameworks today.

Lighttpd is, while less popular http server (with that patchy beast Apache, and that slick new superperformer nginx dominating the market), the best choice for a web server sometimes.

In a nutshell, Apache is bloated, dated, slow and resource hungry, nginx is slick, lean, fast, scales well. It outperfoms Apache on every relevant measure, and as a consequence has been the rising star in http servers for good reason. Almost everywhere I look web focussed FOSS today comes with instructions on how to run it under Apache (just because) and nginx (because that's what everyone does). Go nginx.

So when is lighttpd the server of choice?

I'll leave you to search the reports on-line, they are easy to find, but lighttpd performs on par with nginx on allmeasures. Sometimes a litle better, sometimes a little worse. Like nginx it is written from the godun up to be light, slick, fast and scaleable.

The key differences between lighttpd and nginx for me are:

  • lighttpd is free (as in free beer, as the saying goes), nginx is freemium (free - and open source - but you can pay for more). Freemium and I have love hate relationship. It's a fatastic business model and I love it. But I don't like running into limits behind paywalls either.
  • It is the server of choice in the OpenWRT project. OK, so if you're managing a network with OpenWRT routers (and I do, as a gateway, on WAPS, as DHCP server, DNS server, and more) then you have lighttpd to manage there already. In particular the NAT and reverse Proxy configurations you need for serving from behind a firewall and gateway. And if I'm invested in lighttpd there why not stick with it? Why learn another one. Not least when it's just as good, and free, not freemium.

The black sheep

That said, lighttpd is the black sheep in the family and while the world of web services is falling over itself to provide Apache and nginx compatibility and guides and installers and more, lighttpd is mostly ignored and does a few things a little differently.

One of those is how it delivers SCRIPT_NAME and PATH_INFO. It's not wrong, it's different to Apache and nginx. And Django is one of those projects where development has presumed Apache or nginx and hence a particular SCRIPT_NAME and PATH_INFO convention (which is not a standardised convention alas and up to the http server).

And so this is middleware for Django (or a wsgi_handler replacement) that mapps lighttpds SCRIPT_NAME and PATH_INFO to Django's expectations.

Just add "django_lighttpd_middleware.LighttpdMiddleware" as the first entry in you MIDDLEWARE tuple and you're good to go.

__init__.py contains more notes in its header for the technically oriented.

Metadata

Release files for django-lighttpd-middleware 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-lighttpd-middleware 0.1
File Size Uploaded Provenance Actions
django_lighttpd_middleware-0.1.tar.gz 10.4 kB Without provenance Details for django_lighttpd_middleware-0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-lighttpd-middleware 0.1
File Interpreter ABI Platform Actions
django_lighttpd_middleware-0.1-py3-none-any.whl Python 3 none any Details for django_lighttpd_middleware-0.1-py3-none-any.whl

Total release size: 21.4 kB

Release files / django_lighttpd_middleware-0.1.tar.gz

Download URL django_lighttpd_middleware-0.1.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
51101370d36067912aa1f8193d49de178bc28762ee353a563f4e9e1612fe676e
BLAKE2b-256 checksum
How to use checksums
6d9e541da0c0f45afdeefff3c570823d4a99a132b57d3b2c46c16656b55e3428
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Release files / django_lighttpd_middleware-0.1-py3-none-any.whl

Download URL django_lighttpd_middleware-0.1-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a3620b58c80d81c1aeadb8672d7a3eb57a165f1c0bbedd3563189fa461e57c95
BLAKE2b-256 checksum
How to use checksums
3361df1cb9d40566ca78d7a14affca843cec0cadaa08a48e793acf838efcb79f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

Security for django-lighttpd-middleware 0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page