Django Middleware for running a Django website under lighttpd
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_lighttpd_middleware-0.1.tar.gz
.
File metadata
- Download URL: django_lighttpd_middleware-0.1.tar.gz
- Upload date:
- Size: 10.4 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51101370d36067912aa1f8193d49de178bc28762ee353a563f4e9e1612fe676e |
|
MD5 | 7f75d4a630cfc28ce348671a8395bf27 |
|
BLAKE2b-256 | 6d9e541da0c0f45afdeefff3c570823d4a99a132b57d3b2c46c16656b55e3428 |
File details
Details for the file django_lighttpd_middleware-0.1-py3-none-any.whl
.
File metadata
- Download URL: django_lighttpd_middleware-0.1-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3620b58c80d81c1aeadb8672d7a3eb57a165f1c0bbedd3563189fa461e57c95 |
|
MD5 | dff6cec44c5147ac501401ff601cdbec |
|
BLAKE2b-256 | 3361df1cb9d40566ca78d7a14affca843cec0cadaa08a48e793acf838efcb79f |