I would like to know if there is a way to create web pages without a huge framework in python.
I think of something like PHP/Apache, which comes just as a language and not with to much overhead (but I don't like PHP...). In PHP there is no ORM, no template engine, etc. But it is very very easy to just print a Hello World
to the browser.
I know about Django and really like it, but it is a bit too big for simple web portals (5-10 pages).
I really like something simple, without installing too much.
I'm not sure what's wrong with django flatpages for your purposes.
Another alternative would be to replace the django template system with something more powerful, like jinja, so you can write your tag soup and do processing there, with minimal logic in the view.
In practice (given that you already know django), that is likely to be easier than using a microframework (which requires more of the programmer, in exchange for being completely unopinionated about anything).
Good old CGI is the quickest way to get you started. On most configurations, you just need to drop a python script in 'cgi-bin' and make it executable, no need to install anything. Google for "cgi python", there are lots of tutorials, e.g. this one looks pretty decent.
Sure, you can go really lean with the CGI or
wsgiref
route. However, you get what you pay for, and I prefer Flask or WerkZeug for all the pain they prevent.From wsgiref python docs:
I've used Flask (and bottle.py) in the past, but these days I actually prefer Pyramid, from the Pylons folks.
Pyramid is capable of being a large, full-fledged framework, is designed for flexibility, and has no shortage of plugins and extensions available adding additional functionality -- but it also is capable of small, single-file projects; see this tutorial for an example.
Going with Pyramid will give you room to grow if your needs expand over time, while still retaining the ability to start small.
Python works well using CGI.
that's the simplest thing you can do: it only needs apache and a working python environment, and is the closest to a standard php setup.
remember that, when using CGI, your python script is responsible for outputting the necessary HTTP headers (
sys.stdout.write('Content-Type: text/html\n\n')
), but there is a CGI module which is part of the python standard library which greatly helps dealing with the raw stuffs (post/get arguments parsing, header retrieval, header generation).mod_python perhaps?