Reputation: 26766
We've got a couple of quite complex sites written in Python based on Django, hosted by uwsgi. We also use nginx for some out-of-application things (like SSL termination).
I need to write an incredibly lightweight API which does nothing except validate an authentication token (against a different API) and respond with some info from the local file system.
I'd prefer to avoid using a whole Django site for what will be ~50 lines of code, however, since I develop on a windows machine, I'm not sure how best to host this tiny API for dev/testing. (Django's runserver
command usually handles this for us) uWSGI seems like a good choice for final usage as it's already in use elsewhere but doesn't run on Windows.
I could always just code on one box, deploy and then test but it seems a little long-winded. Ideally, whatever I can find to host on windows will call my code in the same way as uwsgi
What's the best way to do this?
Upvotes: 1
Views: 266
Reputation: 42465
The most lightweight would be wsgiref.simple_server
from the standard library which Django's runserver
command uses internally.
Alternatively you can use
This is a minimalistic WSGI server using Python’s built-in BaseHTTPServer; if pyOpenSSL is installed, it also provides SSL capabilities.
Waitress is meant to be a production-quality pure-Python WSGI server with very acceptable performance. It has no dependencies except ones which live in the Python standard library. It runs on CPython on Unix and Windows under Python 2.6+ and Python 3.2+. It is also known to run on PyPy 1.6.0 on UNIX. It supports HTTP/1.0 and HTTP/1.1.
A high-speed, production ready, thread pooled, generic HTTP server.
Upvotes: 3