Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #96093
| Date | 2015-09-07 14:05 +1000 |
|---|---|
| From | Cameron Simpson <cs@zip.com.au> |
| Subject | Re: Can anyone help me run python scripts with http.server? |
| References | <CAPTjJmrXJeTHdZjg+O7j63-QGE2VwV8PHy2J2PwBe5NGM-5isA@mail.gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.192.1441600481.8327.python-list@python.org> (permalink) |
On 06Sep2015 23:23, Chris Angelico <rosuav@gmail.com> wrote:
>On Sun, Sep 6, 2015 at 11:07 PM, <tropical.dude.net@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:
>https://github.com/Rosuav/MinstrelHall
>
>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.
Cheers,
Cameron Simpson <cs@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@netcom.com>
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Can anyone help me run python scripts with http.server? Cameron Simpson <cs@zip.com.au> - 2015-09-07 14:05 +1000
csiph-web