d33tah
d33tah

Reputation: 11569

Python stand-alone HTTP server with script running support?

I'm writing an application that uses HTML pages as it's user interface - the user runs it on his computer and opens http://localhost:8080. After writing about a thousand lines of code implementing my own vision of MVC model, I noticed I'm pretty much trying to reinvent the wheel - RequestHandler import classes that implement do_POST and do_GET for a specified case, session handling... I've pretty much realized I'm doing it wrong.

I'd prefer to stick to the model that my Python script runs a HTTP server (most prefferably one from the standard library), because I like this architecture. The question is - is there some HTTPServer-like class that would give me an interface similar to CGI (parsing the GET URI, automatically loading the views and models) without giving me a lot of overhead? I'd prefer it to be as small and simple as possible, so if there's no standard library based solution, let it at least be pure Python.

Upvotes: 2

Views: 956

Answers (1)

danodonovan
danodonovan

Reputation: 20373

There is a CGI capable HTTP server already baked into python - that's probably the simplest place to start.

Upvotes: 2

Related Questions