无法访问Apache服务器中部署的Django项目中的依赖模块

时间:2014-06-27 15:37:02

标签: python django apache

我最近将我的Django项目移到了Apache服务器上。在将项目移动到Apache之后,我面临一些关于依赖模块无法访问的问题。

以下是我的配置文件:

这是我在Apache的sites-available目录中的bemoss.conf文件:

WSGIPythonPath /home/kruthika/workspace/bemoss_web_ui
WSGIPythonPath /home/kruthika/workspace/rtunetwork/volttron
WSGIPythonPath  /home/kruthika/workspace/bemoss_web_ui/helper
<VirtualHost *:80>
WSGIScriptAlias / /home/kruthika/workspace/bemoss_web_ui/bemoss.wsgi
ServerName bemoss.com
Alias /static /home/kruthika/workspace/bemoss_web_ui/static
<Directory /home/kruthika/workspace/bemoss_web_ui/>
Order allow,deny
Allow from all
</Directory>
</VirtualHost>

这是我的bemoss.wsgi文件:

import os
import sys
sys.path = ['/home/kruthika/workspace']+sys.path
print sys.path
os.environ['DJANGO_SETTINGS_MODULE']='bemoss_web_ui.settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()

我的项目是从另一个项目访问更多的python文件。我在上面的.conf文件和settings.py文件中添加了对引用的引用,如下所示。

PROJECT_DIR = os.path.dirname(__file__)
print PROJECT_DIR

sys.path.insert(3,os.path.join(PROJECT_DIR,'ZMQHelper'))
sys.path.insert(1,os.path.join(PROJECT_DIR,'helper'))

sys.path.insert(2, '/home/kruthika/workspace/rtunetwork/volttron')
print sys.path

这是我的项目文件夹定义:

enter image description here

当我尝试访问其views.py文件引用上述依赖项的链接时,它会抛出导入模块错误,如下所示。

enter image description here

我的问题是如何引用我的依赖模块/ python类,以便正确导入文件。

当我在Django的开发服务器上执行项目时,所有这些导入工作正常。是否有一些Apache配置我缺少或做错了?我是服务器配置的新手,我想我在这里遗漏了一些东西。

0 个答案:

没有答案
相关问题