开发者

How do I get Phusion Passenger to work with Django for App Engine?

I'm having a devil of a time getting Phusion Passenger to work with django-nonrel for Google's App Engine. I can seem to get it to work for GoogleAppEngineLauncher and for the production server but not Passenger; or for Passenger and GoogleAppEngineLauncher but not the production server; or for Passenger and the production server but not GoogleAppEngineLauncher.

How do I get my app to deploy on all 开发者_开发问答three?


Here's what I needed to do on Mac OS X Snow Leopard:

  1. Put the djangoappengine directory directly in 'ROOT/common-apps'. If you put it outside of your common-apps directory, appengine may get confused and use the djangoappengine dir as your PROJECT_DIR instead of using ROOT as your PROJECT_DIR. You may also need to add an init.py to your common-apps directory.
  2. Put the django-nonrel OUTSIDE of the ROOT directory, and make a symlink from ROOT/common-apps/django to NONROOT/django-nonrel/django. If you put django-nonrel directly into your common-apps directory you'll probably exceed the 3000 file upload limit on app-engine when you go to deploy.
  3. Create an empty ROOT/public directory. Passenger uses the parent of this directory as the project root.
  4. Configure your apache vhost as below, assuming that MYAPPNAME.local is your /etc/hosts
  5. Create passenger_wsgi.py and put it in your ROOT directory as below.

vhosts:

<VirtualHost *:80>
   ServerName MYAPPNAME.local
   DocumentRoot /Users/mike/Projects/ROOT/public
    <Directory  /Users/mike/Projects/ROOT/public>
      AllowOverride all
      Options -MultiViews
      Order allow,deny
      Allow from all
    </Directory>
</VirtualHost>

passenger_wsgi.py:

import os, sys

# BUG there must be a better way than listing everything individually...
sys.path.append('/Users/mike/Projects/ROOT/')
sys.path.append('/Users/mike/Projects/ROOT/common-apps/')
sys.path.append('/Users/mike/Projects/NONROOT/django-nonrel/')
sys.path.append('/usr/local/google_appengine/')
sys.path.append('/usr/local/google_appengine/lib/yaml/lib/')
sys.path.append('/usr/local/google_appengine/lib/antlr3/')
sys.path.append('/usr/local/google_appengine/lib/django/')
sys.path.append('/usr/local/google_appengine/lib/cacerts/')
sys.path.append('/usr/local/google_appengine/lib/ipaddr/')
sys.path.append('/usr/local/google_appengine/lib/webob/')
sys.path.append('/usr/local/google_appengine/google/appengine/api/')

os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

Hopefully I didn't leave anything significant out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜