1

我正在尝试使用 apache webserver 在 RedHat5.6 服务器上以生产模式部署mayan-edms一个 django web 应用程序。

我已经设置了数据库并使用了虚拟环境来设置环境

这是我的 httpd.conf

WSGIScriptAlias /mayan /var/www/mayan/mayan/wsgi/dispatch.wsgi
WSGIPythonPath /var/www/mayan/mayan:/var/www/mayan/lib/python2.6/site-packages
<Directory /var/www/mayan/mayan>
<Files wsgi.py>
Order deny,allow
Allow from all
</Files>
</Directory>

如果我用这个 conf 启动 apache,我会收到 500 错误。谁能告诉我它在哪里配置错误?

这是错误

[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48] mod_wsgi (pid=21715): Exception occurred processing WSGI script '/var/www/mayan/mayan/wsgi/dispatch.wsgi'.
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48] Traceback (most recent call last):
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]   File "/var/www/mayan/lib/python2.6/site-packages/django/core/handlers/wsgi.py", line 250, in __call__
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]     self.load_middleware()
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]   File   "/var/www/mayan/lib/python2.6/site-packages/django/core/handlers/base.py", line 45, in load_middleware
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]     mod = import_module(mw_module)
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]   File "/var/www/mayan/lib/python2.6/site-packages/django/utils/importlib.py", line 35, in import_module
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]     __import__(name)
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]   File "/var/www/mayan/mayan/apps/common/__init__.py", line 17
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]      from .conf.settings import (AUTO_CREATE_ADMIN, AUTO_ADMIN_USERNAME,
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]           ^
[Mon Jan 14 12:47:02 2013] [error] [client 130.229.146.48]  SyntaxError: invalid syntax

这是我在第 17 行的 init.py

from django.db import transaction,  DatabaseError 
from navigation.api import register_links, register_top_menu 
from .conf.settings import (AUTO_CREATE_ADMIN, AUTO_ADMIN_USERNAME, AUTO_ADMIN_PASSWORD, TEMPORARY_DIRECTORY) 
from .conf import settings as common_settings
from .utils import validate_path 
from .models import AutoAdminSingleton
4

2 回答 2

1

听起来像是 Python 版本的问题。RHEL 5.6 似乎是一个相当老的版本,而且无论如何 Red Hat 以捆绑旧版本的 Python 而闻名。查看此表,该版本的 RHEL 似乎甚至不是 Python 2.4。

另一方面,运行当前 Django 版本的最低 Python 版本是 2.7。尽管如此,您的应用程序的 requirements.txt 文件实际上要求使用 Django 1.3.5 - 但您仍然至少需要 Python 2.6。您需要自己编译和安装该版本,或者升级您的 Red Hat 版本。

于 2013-01-14T16:58:16.240 回答
1

您正在使用 python 2.6,安装文档似乎使用 python 2.7

于 2013-01-14T17:02:01.053 回答