我在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和phpMyAdmin在http://localhost/phpmyadmin.They似乎工作正常,但我无法连接到PyAMF网关。使用mod_wsgi在Apache上部署PyAMF Django项目
这里是我的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)
我希望得到任何帮助的内容。
感谢
定义'无法连接'。究竟发生了什么?您的其他应用程序是否有响应?你有错误吗? – 2011-06-16 08:55:22
localhost:80上的php应用程序正常工作。但是,当我连接到localhost:8000时,出现一个错误“无法解析localhost:8000:unknown host。我尝试删除块并尝试'WSGIScriptAlias/gateway /Library/WebServer/Documents/MyApp/hello.py'。这似乎工作正常 –
arjunurs
2011-06-16 17:40:15
你在哪里看到错误“无法解析localhost:8000:未知的主机”? – 2011-06-17 23:40:39