Apache com Django e Python 3.6 e 2.7 com mod_wsgi

-1

Eu estou tentando montar um ambiente virtual para o Django usando o Python 3.6 e o Django 1.11 com o Django CMS 3.5.2. Ele está trabalhando na minha máquina local do CentOS7.

No entanto, quando eu tento instalá-lo em outra máquina CentOS7 que já possui 3 servidores Django instalados com o Python 2.7 em ambientes virtuais distintos, encontrei problemas após instalar a biblioteca python36u-mod_wsgi (yum install python36u-mod_wsgi). Os servidores Apache / Django existentes não funcionavam mais reclamando que o Python não conseguia encontrar a biblioteca psycopg2.

Isso significa que não posso ter servidores Django 2.7 e 3.6 coexistindo no mesmo servidor Apache, mesmo usando virtualenv?

Aqui está o log de erros do Apache para um dos servidores Apache / wsgi / Django existentes (Python 2.7):

[Mon Aug 27 17:43:40.418995 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] File "/var/www/canhemon/venv/lib/python2.7/site-packages/django/db/utils.py", line 115, in load_backend [Mon Aug 27 17:43:40.418998 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] return import_module('%s.base' % backend_name) [Mon Aug 27 17:43:40.419012 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] File "/usr/lib64/python3.6/importlib/init.py", line 126, in import_module [Mon Aug 27 17:43:40.419016 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] return _bootstrap._gcd_import(name[level:], package, level) [Mon Aug 27 17:43:40.419024 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] File "/var/www/canhemon/venv/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 2, in [Mon Aug 27 17:43:40.419028 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] from django.db.backends.postgresql.base import \ [Mon Aug 27 17:43:40.419037 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] File "/var/www/canhemon/venv/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 25, in [Mon Aug 27 17:43:40.419040 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e) [Mon Aug 27 17:43:40.419063 2018] [wsgi:error] [pid 5922] [remote 139.191.17.157:51488] django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: /var/www/canhemon/venv/lib/python2.7/site-packages/psycopg2/_psycopg.so: undefined symbol: PyUnicodeUCS4_DecodeUTF8 [Mon Aug 27 17:43:40.419416 2018] [headers:debug] [pid 5930] mod_headers.c(848): AH01503: headers: ap_headers_error_filter()

Aqui está o log de erros do Apache para o outro servidor Apache / wsgi / Django existente (Python 2.7):

[Mon Aug 27 17:44:13.847871 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] File "/var/www/canopy-validation-tool/venv/lib/python2.7/site-packages/django/db/utils.py", line 115, in load_backend [Mon Aug 27 17:44:13.847875 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] return import_module('%s.base' % backend_name) [Mon Aug 27 17:44:13.847885 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] File "/usr/lib64/python3.6/importlib/init.py", line 126, in import_module [Mon Aug 27 17:44:13.847902 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] return _bootstrap._gcd_import(name[level:], package, level) [Mon Aug 27 17:44:13.847916 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] File "/var/www/canopy-validation-tool/venv/lib/python2.7/site-packages/django/contrib/gis/db/backends/postgis/base.py", line 2, in [Mon Aug 27 17:44:13.847921 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] from django.db.backends.postgresql.base import \ [Mon Aug 27 17:44:13.847931 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] File "/var/www/canopy-validation-tool/venv/lib/python2.7/site-packages/django/db/backends/postgresql/base.py", line 25, in [Mon Aug 27 17:44:13.847936 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] raise ImproperlyConfigured("Error loading psycopg2 module: %s" % e) [Mon Aug 27 17:44:13.847964 2018] [wsgi:error] [pid 5925] [remote 139.191.17.157:51496] django.core.exceptions.ImproperlyConfigured: Error loading psycopg2 module: dynamic module does not define module export function (PyInit__psycopg) [Mon Aug 27 17:44:13.848296 2018] [headers:debug] [pid 5933] mod_headers.c(848): AH01503: headers: ap_headers_error_filter()

    
por Pierric 28.08.2018 / 10:07

0 respostas