mod_wsgi的Apache的错误与Django应用程序(mod_wsgi Apache erro

2019-10-22 00:30发布

我有一个非常有效一Centos7服务器上的Django(1.7)的应用程序。 现在我移动到生产服务器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模块/ 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蟒蛇路径lib64的,但它没有工作

编辑:我知道服务器在/用户/ 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被已编译为32位和mod_wsgi的64个蟒之间的冲突

文章来源: mod_wsgi Apache error with django app