开发者

Deploying PyAMF Django project on Apache with mod_wsgi

I have installed PyAMF, Django, Apache2, and mod_wsgi on a Mac OS X 10.6 machine. While developing the project I used Django development servier. I would like to continue to use http://localhost:8000/gateway or http://127.0.0.1:8000/gateway for the PyAMF gateway. I have my Flex project deployed on http://localhost and phpMyAdmin at http://localhost/phpmyadmin.They seem to work fine but I am not able to connect to the PyAMF gateway.

Here is my Apache setting:

<VirtualHost *:8000>
    # Set this to 'warn' when you're done with debugging
    LogLevel debug

    CustomLog /var/log/apache2/pyamf-access.log combined
    ErrorLog /var/log/apache2/pyamf-error.log

    # PyAMF remoting gateway
    WSGIScriptAlias /gateway /Library/WebServer/Documents/MyApp/django.wsgi

   <Directory /Library/WebServer开发者_StackOverflow中文版/Documents/MyApp>
        WSGIApplicationGroup %{GLOBAL}
        Order allow,deny  
        Allow from all
    </Directory>
</VirtualHost>

Here is the content of the django.wsgi script

import os
import sys

path = '/Library/WebServer/Documents'
if path not in sys.path:
    sys.path.append(path)
    sys.path.append('/Library/WebServer/Documents/MyApp')

os.environ['PYTHON_EGG_CACHE'] = '/tmp'    
os.environ['DJANGO_SETTINGS_MODULE'] = 'MyApp.settings'

import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

import posixpath

def application(environ, start_response):
    # Wrapper to set SCRIPT_NAME to actual mount point.
    environ['SCRIPT_NAME'] = posixpath.dirname(environ['SCRIPT_NAME'])
    if environ['SCRIPT_NAME'] == '/':
        environ['SCRIPT_NAME'] = ''
    return _application(environ, start_response)

I would appreciate any help.

Thanks


When you added separate VirtualHost on port 8000, did you also add to Apache configuration in appropriate place:

NameVirtualHost *:8000

Usually there would only be such a line for port 80.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜