2017-02-20 1 views
0

J'ai essayé de comprendre ce qui cause ce problème pendant des heures mais sans succès.Apache/mod_wsgi/django/arch linux malheurs depuis la mise à niveau 64 bits, malgré le fait d'avoir pu importer toutes les bibliothèques

Depuis la migration de mon arc installation de Linux à 64 bits que j'ai trouvé mes sites django ne fonctionnent pas, avec l'erreur 500. J'utilise python2, qui est de 64 bits:

>>> import struct 
>>> print struct.calcsize("P") * 8 
64 

Et moi aussi ont 64 bits mod_wsgi2: https://www.archlinux.org/packages/community/x86_64/mod_wsgi2/

Voici un journal d'exemple:

[Mon Feb 20 21:42:40.312829 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] mod_wsgi (pid=19537): Target WSGI script '/home/james/sites/dse/django.wsgi' cannot be loaded as Python module. 
[Mon Feb 20 21:42:40.312872 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] mod_wsgi (pid=19537): Exception occurred processing WSGI script '/home/james/sites/dse/django.wsgi'. 
[Mon Feb 20 21:42:40.312916 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] Traceback (most recent call last): 
[Mon Feb 20 21:42:40.312953 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] File "/home/james/sites/dse/django.wsgi", line 12, in <module> 
[Mon Feb 20 21:42:40.312997 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]  from django.core.wsgi import get_wsgi_application 
[Mon Feb 20 21:42:40.313006 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] File "/usr/lib/python2.7/site-packages/django/__init__.py", line 3, in <module> 
[Mon Feb 20 21:42:40.313056 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]  from django.utils.version import get_version 
[Mon Feb 20 21:42:40.313066 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] File "/usr/lib/python2.7/site-packages/django/utils/version.py", line 3, in <module> 
[Mon Feb 20 21:42:40.313078 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898]  import datetime 
[Mon Feb 20 21:42:40.313103 2017] [wsgi:error] [pid 19537] [client 146.179.195.99:62898] ImportError: /usr/lib/python2.7/lib-dynload/datetime.so: wrong ELF class: ELFCLASS64 
[Mon Feb 20 21:42:40.313185 2017] [access_compat:error] [pid 19537] [client 146.179.195.99:62898] AH01797: client denied by server configuration: /usr/share/httpd/error/HTTP_INTERNAL_SERVER_ERROR.html.var 

Alors, j'ai essayé d'importer toutes ces choses manuellement pour voir si je suis une erreur, Nope:

[[email protected] ~]$ python2 
Python 2.7.13 (default, Dec 21 2016, 07:16:46) 
[GCC 6.2.1 20160830] on linux2 
Type "help", "copyright", "credits" or "license" for more information. 
>>> import datetime 
>>> import django 
>>> from django.core.wsgi import get_wsgi_application 
>>> from django.utils.version import get_version 

J'ai vérifié que j'ai: LoadModule wsgi_module/mod_wsgi.so

Dans mon httpd.conf, et le contenu de/home/James/sites/dse/django fichier .wsgi impliqué dans l'erreur n'a pas changé en 3 ans environ et sont les suivants (!):

[[email protected] dse]$ cat django.wsgi 
import os 
import sys 

sys.path.append('/home/james/sites/dse/django_dse') 
sys.path.append('/home/james/sites/dse') 

os.environ['DJANGO_SETTINGS_MODULE'] = 'django_dse.settings' 

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

Je ne suis pas sûr de ce qu'il faut faire. Je veux dire que cela ressemble à un problème de compatibilité 32/64 bits avec l'erreur étant ImportError: /usr/lib/python2.7/lib-dynload/datetime.so: mauvaise classe ELF: ELFCLASS64 - mais je ne peux pas comprendre ce qui le cause.

Des idées?

+0

Si vous utilisez un environnement virtuel Python, l'avez-vous recréé. –

Répondre

0

Il s'avère que l'erreur était en réalité dans un module apache distinct en cours de chargement qui n'était PAS 64 bits. Je chargeais un module 32 bits dans mon httpd.conf:

LoadModule fastcgi_module modules/mod_fastcgi.so 

La façon dont je fait identifiais c'était en exécutant le programme « apachectl » qui m'a alors donné une erreur liée à l'importation du module 32 bits. Quand cela a été commenté, tous mes sites Web django 64 bits sont revenus à la vie. Je ne sais pas pourquoi cela s'est manifesté comme ça ...