[Tutor] Database driven web sites with python

Magnus Lycka magnus@thinkware.se
Sat Jan 18 04:40:01 2003


At 18:05 2003-01-17 -0700, Danny wrote:
>Quick and easy question, can you use python to build database driven web 
>sites.

Short answer:

Yes.

Long answer:

Of course you can, and many people do. Some of the worlds
leading web sites and applications are python powered.

There are two paper books dedicated to the subject, see
http://www.python.org/cgi-bin/moinmoin/WebProgrammingBooks

For some other resoures, see
http://www.python.org/cgi-bin/moinmoin/WebProgramming
http://www.thinkware.se/cgi-bin/thinki.cgi/PythonForInternet
and http://www.python.org/topics/database/

One factor you have to take into consideration is how you are going to
deploy your application. Are you able to execute long-running processes
on the server, or do you have to restrict yourself to cgi-scripts? Some
tools, such as Zope are fairly hopeless to run as CGI scripts. They have
all too long startup time.

One tool that I like is CherryPy, http://www.cherrypy.org/ . It fits my brain.
It contains the stuff I need, and it restricts itself to web stuff. I don't
like tools that try to be everything at once, but prefer a layered approach.
It also wants to have a long running process though.

ZOPE, http://www.zope.org/ , as Bob mentioned is a big system for creating
dynamic web content. Too big, some may say. Actually, you might work a long
time in Zope without ever writing a line of python code... It *is* intented
to be usable for non-programmers, but there is a lot of zopeish things to
learn, so in addition to python, there are a lot of other things to think
about. Also, the things you create such as layout, access rules, page
structures etc are stored in Zope's builtin object database. This means that
you can't use standard stuff file handling tools as grep and find to search
for things in your application. Personally I don't like this--I get a little
lost, just as when I develop things in tools like Excel or Visual Basic. I
want everything to be plain code in text files. On the other hand, there is
not other tool that will give you as many features for free as Zope does. It
really has an amazing amount of modules and features. If your system is to
grow big, you might have to develop a lot of these things on your own if you
don't use Zope.

Your choice of tools really depends on how you want to work and what kind of
web site it is. Is there a lot of advanced logic, or are you mainly serving
pages? Do you need user authentication and security aspects? Is it a small
system or a big system? What kind of control do you have over the server?
Don't trust anyone who says that one size fits all...


/Magnus


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se