Created
January 29, 2010 04:35
-
-
Save luispedro/289450 to your computer and use it in GitHub Desktop.
Debug passenger_wsgi on dreamhost
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 sys, os | |
INTERP = "/home/papsweb/virtualenv/bin/python" | |
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv) | |
sys.path.append(os.getcwd()) | |
sys.path.append(os.getcwd()+'/papswebsite') | |
os.environ['DJANGO_SETTINGS_MODULE'] = "papswebsite.settings" | |
import django.core.handlers.wsgi | |
_application = django.core.handlers.wsgi.WSGIHandler() | |
log = file("/home/papsweb/passenger.log",'w') | |
print >>log, "Running ", sys.executable | |
def application(*args, **kwargs): | |
print >>log, 'Called', args, kwargs | |
log.flush() | |
try: | |
res = _application(*args, **kwargs) | |
print >>log, 'no pb mate' | |
log.close() | |
return res | |
except Exception, exc: | |
print >>log, 'exception', exc | |
print >>log, 'done mate' | |
log.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment