Problem configuring apache to run python cgi on Ubuntu 14.04

Chris Angelico rosuav at gmail.com
Tue Sep 22 00:36:48 CEST 2015


On Tue, Sep 22, 2015 at 7:36 AM,  <tropical.dude.net at gmail.com> wrote:
> Thank you very much. Can I write .py pages like in PHP or should I
> use a framework like Django, Web2py or TurboGears?

I recommend using WSGI and a framework that uses it (my personal
preference is Flask, but the above will also work). Here are a couple
of simple sites:

https://github.com/Rosuav/Flask1
https://github.com/Rosuav/MinstrelHall

You can see them in operation here:

http://rosuav.com/1/
http://minstrelhall.com/

Note how URLs are defined in the code, rather than by having a bunch
of loose files (the way a PHP web site works). This makes it a lot
easier to group things logically, and utility lines like redirects
become very cheap. The maintenance burden is far lighter with this
kind of one-file arrangement.

These sites are really tiny, though, so if you have something a bit
bigger, you'll probably want to split things into multiple files. Good
news! You can do that, too - it's easy enough to split on any boundary
you find logical.

ChrisA


More information about the Python-list mailing list