views:

373

answers:

6

Not exactly about programming, but I need help with this.

I'm running a development sever with WampServer. I want to install Python (because I prefer to use Python over PHP), but it seems there isn't an obvious choice. I've read about mod_python and WSGI, and about how the latter is better.

However, from what I gathered (I may be wrong) you have to do more low-level stuff with WSGI than with PHP. So I researched about Django, but it seems too complex for what I want.

So, what recommendations would you give to a newbie in this area?

Again, sorry if this isn't about programming, but it's related, and this seems like a nice place to ask.

+4  A: 

Django is not a web server, but a web application framework.

If you want a bare-bones Python webserver capable of some dynamic and some static content, have a look at CherryPy.

James Emerton
A: 

To use python with your Apache server you need to install mod_python the following links should help you out a bit.

Mike Lowen
-1 for recommending brain-dead mod_python.
nosklo
A: 

If it's truly a development server you're setting up, and not a machine that will be promoted to production at some point, Django has a built-in development webserver that requires no Apache configuration.

Your observation about the low-level work reflects some of the differences between PHP and Python. PHP is a language designed from the start for the primary purpose of making web pages. Python is a language. Mod_Python and Mod_WSGI give the input to/output from that language a way to live in a web request/response environment. Django adds web-aware framework conveniences.

You mention that python seems too complex for what you want, which rather begs the question: what do you want? :-)

Jarret Hardie
Well, I want a kind of simple website. I'll have a special calculator (which I have already done in PHP), and maybe I'll make a simple blog as a learning experience. It's not that I can't use PHP, it's that I don't want to.
+2  A: 

Use mod_wsgi to embed Python in Apache. It works very, very well.

"However, from what I gathered (I may be wrong) you have to do more low-level stuff with WSGI than with PHP. So I researched about Django, but it seems too complex for what I want."

  1. If you try to write your entire application as a WSGI-compliant application, directly accessed via mod_wsgi, you will reinvent the wheel.

  2. If you try to write your application in Django, you will have stuff up and running in the space of a few hours. Django is not "too complex" -- it's complete. You don't have to use all of it, but -- for any realistic application -- you'll need most of it. In particular, the built-in admin will save you mountains of programming.

S.Lott
But can Django be used just as a collection of tools to make development easier? The tutorials at the website make it look almost like a CMS.
@ReyJavik: Django is just a framework -- emphatically not a CMS. There are several CMS available, written in Django. http://django-cms.org/, also http://www.ellingtoncms.com/.
S.Lott
+2  A: 

Werkzeug is a great little python tool (werkzeug) that works with mod_wsgi for creating simple apps that dont need database backends with CMS's, such as calculators .. They've even got a nifty screencast where they create a simple wiki in 30 minutes.

You can always add something like SQLAlchemy/FormAlchemy later on if you eventually do want to have a ORM and CMS.

Avoid mod_python tho, it's got a pretty big memory footprint and it's actually a bit harder to install and set up than mod_wsgi, in my opinion.

Silfheed
A: 

Here is a live document about serving django apps http://lincolnloop.com/django-best-practices/deployment/servers.html

Rasiel