Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在OS 10.9服务器上部署Django_Python_Django_Apache_Pythonpath_Osx Server - Fatal编程技术网

Python 在OS 10.9服务器上部署Django

Python 在OS 10.9服务器上部署Django,python,django,apache,pythonpath,osx-server,Python,Django,Apache,Pythonpath,Osx Server,我有一个使用Django的项目,我正试图将它部署在运行OSX服务器(10.9)的机器上的本地网络上。我可以使用项目的manage.py脚本在本地运行它,并拥有所有依赖项和所有内容,但我很难通过Server.app让它作为常规网站运行。以下是服务器上的web应用程序所需的项目配置文件,所有这些文件都指向中的实际代码: /Library/Server/Web/Data/WebApps/project/.../ (我保证,这不是真正命名的项目): /Library/Server/Web/Config

我有一个使用Django的项目,我正试图将它部署在运行OSX服务器(10.9)的机器上的本地网络上。我可以使用项目的manage.py脚本在本地运行它,并拥有所有依赖项和所有内容,但我很难通过Server.app让它作为常规网站运行。以下是服务器上的web应用程序所需的项目配置文件,所有这些文件都指向中的实际代码:

/Library/Server/Web/Data/WebApps/project/.../
(我保证,这不是真正命名的项目):

/Library/Server/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>

这对我来说很奇怪,因为我已经将该目录添加到PYTHONPATH中,并且可以从Python提示符导入project.settings。至少它调用了我的代码,但我无法解决这个系统路径问题。有什么想法吗?

我昨天刚用OS 10.9服务器安装了django 1.6.1

文件/Library/Server/Web/Config/apache2/httpd_wsgi2.conf [……]

[……]

最后是wsgi.py文件

[……]

[……]

确保您现在在Server.app中创建了一个虚拟站点


干杯,Jens

我对Server.app一无所知,但它是以什么用户的身份运行的?您说该目录在PYTHONPATH中,但可能服务器没有像您一样运行。它是以管理员帐户运行的,我手动将PYTHONPATH添加(导出)到我的.bash_配置文件中。现在我考虑一下,是否还有其他地方需要指定它,以便Apache能够识别它,而不是bash会话?
[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
WSGIScriptAlias / /Users/jens/Source/macmini/macmini/macmini.wsgi

<Directory /Users/jens/Source/macmini>
Order allow,deny
Allow from all
</Directory>
<?xml version="1.0" encoding="UTF-7"?>
<!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.wsgi2</string>
        <key>displayName</key>
        <string>Django 1.6.1 Setup at / </string>
        <key>launchKeys</key>
        <array/>
        <key>proxies</key>
        <dict/>
        <key>installationIndicatorFilePath</key>
        <string>/Users/jens/Source/macmini/macmini/macmini.wsgi</string>
        <key>includeFiles</key>
        <array>
                <string>/Library/Server/Web/Config/apache2/httpd_wsgi2.conf</string>
        </array>
        <key>requiredModuleNames</key>
        <array>
                <string>wsgi_module</string>
        </array>
</dict>
</plist>
macmini:macmini jens$ ls -l
total 72
-rw-r--r--  1 jens  staff     0 14 Jan 20:43 __init__.py
-rw-r--r--  1 jens  staff   133 14 Jan 21:10 __init__.pyc
-rwxr-xr-x  1 jens  staff   482 15 Jan 09:43 macmini.wsgi
-rw-r--r--  1 jens  staff  4384 15 Jan 17:15 settings.py
-rw-r--r--  1 jens  staff  3902 15 Jan 17:16 settings.pyc
-rw-r--r--  1 jens  staff   298 14 Jan 20:43 urls.py
-rw-r--r--  1 jens  staff   413 14 Jan 21:53 urls.pyc
-rwxr-xr-x  1 jens  staff   466 14 Jan 23:46 wsgi.py
-rw-r--r--  1 jens  staff   590 14 Jan 21:52 wsgi.pyc
"""
WSGI config for macmini project.

It exposes the WSGI callable as a module-level variable named ``application``.

For more information on this file, see
https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/
"""

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "macmini.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()