A note about serving static files with Python's wsgi

Wednesday, 14 October 2015

A note about serving static files with Python's wsgi

Openshift is great and making a python server is really straight forward. The only catch is that wsgi tries to serve static files. The solution serverside is to add a folder wsgi/static, which works a treat, locally it is a different matter. Some Python subversions ago, I could get the localhost to server from static (not wsgi/static), which is fine given that the localhost wsgi.py is __main__, while on Openshift it isn't, so I just had two copies of static. Since some upgrade, my locally run wsgi.py hates serving static files. I looked on the web and nothing was the quick botch I needed. This is what I added to the part where a GET method is processed.

No comments:

Post a Comment