我在 Mac OS X 10.6 机器上安装了 PyAMF、Django、Apache2 和 mod_wsgi。在开发项目时,我使用了 Django 开发服务器。我想继续使用http://localhost:8000/gateway或http://127.0.0.1:8000/gateway作为 PyAMF 网关。我将我的 Flex 项目部署在http://localhost和 http://localhost/phpmyadmin 的 phpMyAdmin 上。它们似乎工作正常,但我无法连接到 PyAMF 网关。
这是我的 Apache 设置:
<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/Documents/MyApp>
WSGIApplicationGroup %{GLOBAL}
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
这是 django.wsgi 脚本的内容
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)
我将不胜感激任何帮助。
谢谢