mod_wsgi django app的Apache错误

时间:2015-02-20 18:34:12

标签: python django apache mod-wsgi rhel6

我有一个django(1.7)应用程序在Centos7服务器上运行良好。现在我转移到生产服务器RHEL 6,仍然有一些问题。

问题是mod_wsgi。

服务器配置:

  • RHEL6
  • Apache 2.2
  • Django 1.7
  • Python 2.6

apache错误日志

[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Target WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py' cannot be loaded as Python module.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Exception occurred processing WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py'.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] Traceback (most recent call last):
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1]   File "/home/evtdb/FLWeb/FLWeb/wsgi.py", line 21, in <module>
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1]     from django.core.wsgi import get_wsgi_application
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] ImportError: No module named django.core.wsgi
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Target WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py' cannot be loaded as Python module.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] mod_wsgi (pid=12827): Exception occurred processing WSGI script '/home/evtdb/FLWeb/FLWeb/wsgi.py'.
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] Traceback (most recent call last):
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1]   File "/home/evtdb/FLWeb/FLWeb/wsgi.py", line 21, in <module>
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1]     from django.core.wsgi import get_wsgi_application
[Fri Feb 20 11:18:39 2015] [error] [client 127.0.0.1] ImportError: No module named django.core.wsgi

其他重要文件

flweb.conf

WSGIScriptAlias / /home/evtdb/FLWeb/FLWeb/wsgi.py

WSGIDaemonProcess localhost python-path=/home/evtdb/FLWeb:/usr/lib/python2.6/site-packages
WSGIProcessGroup localhost

<VirtualHost 127.0.0.1:8080>

        <Directory /home/evtdb/FLWeb/FLWeb>
        <Files wsgi.py>

                Order allow,deny
                Allow from all
        </Files>
        </Directory>

</VirtualHost>

wsgi.py

"""
WSGI config for FLWeb 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.7/howto/deployment/wsgi/
"""

import os


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "FLWeb.settings")

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

ldd modules / mod_wsgi.so

linux-vdso.so.1 =>  (0x00007fff6afff000)
    libpython2.6.so.1.0 => /usr/lib64/libpython2.6.so.1.0 (0x00007fd69fc02000)
    libpthread.so.0 => /lib64/libpthread.so.0 (0x00007fd69f9e5000)
    libdl.so.2 => /lib64/libdl.so.2 (0x00007fd69f7e0000)
    libutil.so.1 => /lib64/libutil.so.1 (0x00007fd69f5dd000)
    libm.so.6 => /lib64/libm.so.6 (0x00007fd69f359000)
    libc.so.6 => /lib64/libc.so.6 (0x00007fd69efc4000)
    /lib64/ld-linux-x86-64.so.2 (0x000000330aa00000)

我认为问题可能是mod_wsgi似乎是用lib64编译的,所以我将flweb.conf上的python路径更改为lib64,但它没有工作

修改 我意识到服务器在/ user / local / lib中有python 2.7,这是安装了django的python版本。我改变了conf文件中的路径,但现在我想我需要重建mod_wsgi

EDIT2: 试图重建mod_wsgi,有这个问题

/usr/bin/ld: /usr/local/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a shared object; recompile with -fPIC

根据https://code.google.com/p/modwsgi/wiki/InstallationIssues是python之间的冲突,编译为32位,mod_wsgi为64

0 个答案:

没有答案