我有一个项目使用Django,我试图在运行OS X Server(10.9)的机器上的本地网络上部署Django。我可以使用项目的manage.py脚本在本地运行它,并拥有所有依赖关系和所有内容,但我一直在努力通过Server.app将它作为常规网站运行。下面是配置文件在服务器上的Web应用程序所需要的项目,都指向实际代码:在OS 10.9服务器上部署Django
/Library/Server/Web/Data/WebApps/project/.../
(它实际上没有命名的项目,我保证):
/库/服务器/Web/Config/apache2/httpd_project.conf
WSGIScriptAlias /unity /Library/Server/Web/Data/WebApps/unity/unity/site.wsgi
/Library/Server/Web/Config/apache2/webapps/com.apple.webapp.project.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN""http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>com.apple.webapp.project</string>
<key>displayName</key>
<string>Daily Download</string>
<key>launchKeys</key>
<array/>
<key>proxies</key>
<dict/>
<key>installationIndicatorFilePath</key>
<string>/Library/Server/Web/Data/WebApps/project/project/site.wsgi</string>
<key>includeFiles</key>
<array>
<string>/Library/Server/Web/Config/apache2/httpd_project.conf</string>
</array>
<key>requiredModuleNames</key>
<array>
<string>wsgi_module</string>
</array>
我已经将它作为网站添加到了Server.app中。问题是,我得到500错误在/私营/无功以下条目/日志/的Apache2/error_log中:
[Mon Jan 06 14:55:21 2014] [error] [client 17.19.244.170] ImportError: Could not import settings 'project.settings' (Is it on sys.path? Is there an import error in the settings file?): No module named unity.settings
这是怪我,因为我已经添加该目录到我的PYTHONPATH和能从Python提示符导入project.settings。至少它在调用我的代码,但我无法弄清楚这个系统路径问题。有任何想法吗?
我不知道任何关于Server.app,但什么用户它运行?你说这个目录在你的PYTHONPATH中,但大概服务器没有像你那样运行。 –
它以管理员帐户运行,我手动添加(导出)PYTHONPATH到我的.bash_profile。现在我想到了,是否还有另一个地方需要指定它,以便它可以被Apache识别而不是bash会话? – drodman