7

I would like to start writing Python web apps, first start simple like servlets in Java, then move to some web frameworks.

What server could I use to develop the apps? Is there a Tomcat version for Python? Is Apache with mod_python the way to go or something else?

I would like to know some options that may help with:

  1. Python based local web development in my own laptop/ PC.
  2. Creating production ready Python web applications.

Thank you!

PS: It is for Python 2.6.5, if that makes a difference

Rishabh Jain
  • 518
  • 6
  • 11
StupidLearner
  • 71
  • 1
  • 1
  • 3
  • 1
    Did you search SO for "[python] web server"? Almost everyone disagrees on Apache vs. nginx. Read this question, for example.http://stackoverflow.com/questions/195534/in-production-apache-mod-wsgi-or-nginx-mod-wsgi. – S.Lott Aug 12 '10 at 12:12

5 Answers5

4

Tomcat is as far as I know only for Java.

You could use the Django-Framework. It has a integrated developmentserver and you can use Apache for a productive enviroment. But i recommend mod_wsgi instead of mod_python.

Here is an example for an wsgi application with apache and django:

# Apache Config
<VirtualHost *>
    ServerName example.com
    WSGIScriptAlias / /var/www/example/site.wsgi
    ErrorLog /var/log/apache2/error.log
</VirtualHost>


# site.wsgi
import os
import sys

sys.path.append( rel(".") )

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
svenwltr
  • 17,002
  • 12
  • 56
  • 68
1

I realize this question was posted a long time ago, but Zope would be an alternative http://www.zope.org/

Jeff D
  • 11
  • 1
0

There is Django. I guess this could do the job.

Here is a good overview about this.

schoetbi
  • 12,009
  • 10
  • 54
  • 72
  • Do all frameworks contain a server? Are there differences between them (i.e. You can run only one type of framework on one type of server). Is there something like a "servlet" specificaction that all respect (sorry... I only know how stuff works in Java, I'm trying to understand by comparison) – StupidLearner Aug 12 '10 at 12:22
  • For a comparison of the j2ee terms to the python appserver terms check this out: http://www.boddie.org.uk/python/web_modules_enterprise.html. Here another good source: http://list.fudosys.com/pipermail/calendula-devel/2004-April/000058.html – schoetbi Aug 12 '10 at 19:07
0
  • CherryPy http://www.cherrypy.org/
  • Google AppEngine appengine.google.com
  • Apache mod_py apache.org
  • lighthttp must also have python support lighthttp.org
Julius F
  • 3,434
  • 4
  • 29
  • 44
0

I would highly suggest learning Twisted. It makes webservers easy. It is an asynchronous framework the relies on the idea of callbacks. You set up a server. You define how the server responds to different inputs. And then as it receives data it will call the proper methods to handle each incoming request. the twisted.web http module is also very robust yet easy to step into. Great place to start.

See: the following

themaestro
  • 13,750
  • 20
  • 56
  • 75