python - Django - python3.4 virtualenv - apache -
i have django app i've been working on debugging using manage.py runserver.
i'm attempting serve apache/mod_wsgi.
when try open home page received 500 error. log file shows syntax error in functools.py.
mod_wsgi (pid=28016): target wsgi script '/home/username/projects/django/testing/testing/wsgi.py' cannot loaded python module. mod_wsgi (pid=28016): exception occurred processing wsgi script '/home/username/projects/django/testing/testing/wsgi.py'. traceback (most recent call last): file "/home/username/projects/django/testing/testing/wsgi.py", line 12, in <module> django.core.wsgi import get_wsgi_application file "/home/username/.virtualenvs/testing/lib/python3.4/site-packages/django/__init__.py", line 1, in <module> django.utils.version import get_version file "/home/username/.virtualenvs/testing/lib/python3.4/site-packages/django/utils/version.py", line 7, in <module> django.utils.lru_cache import lru_cache file "/home/username/.virtualenvs/testing/lib/python3.4/site-packages/django/utils/lru_cache.py", line 2, in <module> functools import lru_cache file "/home/username/.virtualenvs/testing/lib/python3.4/functools.py", line 291 cls_or_self, *rest = args ^ syntaxerror: invalid syntax
as far can tell valid python3.4 syntax. i'm not entirely sure if have wsgi configured correctly use virtualenv.
#testing.conf <virtualhost *:80> wsgidaemonprocess django.testing.username.vni user=username group=username python-path=/home/username/.virtualenvs/testing/lib/python3.4/site-packages:/home/username/.virtualenvs/testing/lib/python3.4:/home/username/.virtualenvs/testing wsgiprocessgroup django.testing.username.vni wsgiscriptalias / /home/username/projects/django/testing/testing/wsgi.py serveradmin username@webserver.com servername django.testing serveralias www.django.testing alias /static/ /home/username/projects/django/testing/static/ <directory /> allowoverride none options -indexes </directory> <directory /home/username/projects/django/testing/testing> <files wsgi.py> require granted </files> </directory> errorlog /var/log/apache2/django.testing.log loglevel warn </virtualhost>
i think might have problematic python-path above.
#wsgi.py import os django.core.wsgi import get_wsgi_application import sys sys.path.append(os.path.dirname(os.path.abspath(__file__)) + "/..") sys.path.append(os.path.dirname(os.path.abspath(__file__))) #os.environ.setdefault("django_settings_module", "testing.settings") os.environ.setdefault("django_settings_module", "settings") application = get_wsgi_application()
i'm not sure if i've handled sys.path.append()'s or django_settings_module. they hack around few other errors ran into.
as suggested daniel roseman, issue had wrong version of mod_wsgi python3.4. removed libapache2-mod-wsgi , installed libapache2-mod-wsgi-py3.
Comments
Post a Comment