Python on web with mod_python

J

Jason Tesser

I am thinking about developing a CMS with Python and Postgres. I am developing
on a Linux box with Apache 2. I have used PHP in the past but my at work we are
considering going with Python as our main devellopment language. A few
questions for you guys.

1. Is it best to just develop in all Pyhton or to use a mixture of PHP and Python?
Why other than personal feelings?

2. What is the best way to template using Python for me to seperate content
from logic? All the data that will be displayed in dynamic so I am not sure
what the best way to template it would be in Python.

Thank you for any thoughts offered.
 
P

Peter Hansen

Jason said:
I am thinking about developing a CMS with Python and Postgres. I am developing
on a Linux box with Apache 2. I have used PHP in the past but my at work we are
considering going with Python as our main devellopment language. A few
questions for you guys.

1. Is it best to just develop in all Pyhton or to use a mixture of PHP and Python?
Why other than personal feelings?

I wouldn't bother with PHP, for several reasons. One is that it's
(IMHO) a hodge-podge dog's breakfast of junk that doesn't have real
design behind it, another is that Python can do anything it can do,
and more readably, and a third is that I like to minimize the number
of different technologies used on a given project, to increase
maintainability, and to maintain the sanity of developers.
2. What is the best way to template using Python for me to seperate content
from logic? All the data that will be displayed in dynamic so I am not sure
what the best way to template it would be in Python.

http://webware.sourceforge.net/Papers/Templates/ has an overview, and
Googling for "python template language" or similar will give you that
page and dozens more that will give you a good start.

There is no "best way": what is best for you depends on more information
than you've provided, and is largely based on personal preference
anyway.

-Peter
 
D

David M. Wilson

Jason Tesser said:
1. Is it best to just develop in all Pyhton or to use a mixture of PHP
and Python?

Use Python.

Why other than personal feelings?

In the case of PHP, I find it quite hard to seperate the personal from
the objective, but here we go:

- Python code tends to last. Code developed for Python 1.5.2 still
works today. Python didn't change the setting of 'register_globals'
overnight, or modify fundantal ways in which code is parsed.

- Python code is naturally structured. It could be argued that PHP
gives you the flexibility to decide on your own code modularisation,
but that means devising a robust system and sticking to it. When such
modularisation is part of the core language, such things are natural.

- Other people's Python code tends to be much better written. Take a
look for yourself at freshmeat.net. Sample 5 PHP-based projects. Were
you impressed by the quality of code you saw? Was it documented? Was
it even readable?

- Python has a clear future roadmap, whereas PHP has been confused
about it's sexuality for years now.


2. What is the best way to template using Python for me to seperate
content
from logic? All the data that will be displayed in dynamic so I am not
sure
what the best way to template it would be in Python.

This has been a biggy for me recently. I haven't wanted to tie myself
in to a big python CMS for writing my web applications, and have spent
quite a few months hmm'ing and hah'ing over exactly how HTML, Code,
the client, and the Web server are all seperated.

My own solution is probably going to be PyMeld for templating, for
it's utter simplicity and perfect division between design & HTML, with
mod_python for talking to the clients. PyMeld will get wrapped in an
interface abstraction so that I can swap it out if I later desire to,
and the main web application itself will be implemented as pure
Python. The interface will be responsible for converting it to an HTML
representation.

In future if I for eg., wish to add XML-RPC or WAP support to my
application, I can do so through new implementations of the interface
abstraction.

I'm ranting. It's 07:30hrs and I am going to work in an hour. Tired.

To cut a long, boring story short, after a long time of waiting I
found PyMeld. It's lovely. Use it. :)


http://www.entrian.com/PyMeld/


David.
 
J

JZ

I am thinking about developing a CMS with Python and Postgres.

Look at Plone http://www.plone.org. It is ready to use, powerfull CMS
system based on Zope http://www.zope.org
1. Is it best to just develop in all Pyhton or to use a mixture of PHP and Python?
Why other than personal feelings?

There is no need for such mixture. Python should be enough.
2. What is the best way to template using Python for me to seperate content
from logic? All the data that will be displayed in dynamic so I am not sure
what the best way to template it would be in Python.

I am also a PHP programmer and I had the same problem some times ago.
I think, the best solution is an application serwer Webware
http://webware.sourceforge.net and Cheetah
http://www.cheetahtemplate.org as a template system.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top