Can anyone help me run python scripts with http.server?
cs at zip.com.au
Mon Sep 7 06:05:25 CEST 2015
On 06Sep2015 23:23, Chris Angelico <rosuav at gmail.com> wrote:
>On Sun, Sep 6, 2015 at 11:07 PM, <tropical.dude.net at gmail.com> wrote:
>> I will definitely look into python web frameworks in the future, they seem
>> complicated to me compared to php for example. I am looking for the simplest
>> way to test my python scripts till I understand better how it works and when
>> I can configure my own web server to run the framework because I want develop my
>> stuff offline.
>Look into Flask. You can do something really simple:
>All the code is in one file for simplicity, though for a larger
>project, you can break it up as required. (Compared to PHP, where
>you're _forced_ to have exactly one file per entry-point, this is a
>nice flexibility.) Then I just have one line in my Apache config file
>that looks something like this:
>WSGIScriptAlias / /path/to/scripts/MinstrelHall/mh.wsgi
>and Apache does all the rest. There's some cruft in that code to get
>around a few oddities, but for the most part, writing a page is as
>simple as writing a function, decorated to manage routing, that
>returns render_template("somefile.html"). It's pretty easy.
Another nice thing about Flask is that you can run it standalone without
Apache. I'm knocking something together right now using Flask, and I'm
intending to run it without Apache at all. There'll be an haproxy in front of
it for other reasons, but to get off the ground you don't even need that.
Cameron Simpson <cs at zip.com.au>
If you take something apart and put it back together again enough times, you
will eventually have enough parts left over to build a second one.
- Ayse Sercan <ayse at netcom.com>
More information about the Python-list