Created
January 4, 2011 14:34
-
-
Save paolo-losi/764824 to your computer and use it in GitHub Desktop.
Cherrypy serving Django
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
from cherrypy import wsgiserver | |
from paste.translogger import TransLogger | |
os.environ['DJANGO_SETTINGS_MODULE'] = 'meteoweb.settings' | |
import django.core.handlers.wsgi | |
application = django.core.handlers.wsgi.WSGIHandler() | |
def main(): | |
logged_app = TransLogger(application) | |
server = wsgiserver.CherryPyWSGIServer(('127.0.0.1', 8080), logged_app) | |
try: | |
server.start() | |
except KeyboardInterrupt: | |
server.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment