SyntaxError at django with Apache and wsgi
这是运行django应用程序时
1 2 3 4 5 6 7 8 9 10 | File"/var/www/html/mailqenv/lib/python3.4/site-packages/celery/utils/functional.py", line 11, in <module> [Tue Nov 28 21:26:18.349280 2017] [:error] [pid 3665] [remote 41.187.94.200:84] from kombu.utils.functional import ( [Tue Nov 28 21:26:18.349296 2017] [:error] [pid 3665] [remote 41.187.94.200:84] File"/var/www/html/mailqenv/lib/python3.4/site-packages/kombu/utils/__init__.py", line 5, in <module> [Tue Nov 28 21:26:18.349322 2017] [:error] [pid 3665] [remote 41.187.94.200:84] from .compat import fileno, maybe_fileno, nested, register_after_fork [Tue Nov 28 21:26:18.349333 2017] [:error] [pid 3665] [remote 41.187.94.200:84] File"/var/www/html/mailqenv/lib/python3.4/site-packages/kombu/utils/compat.py", line 29, in <module> [Tue Nov 28 21:26:18.349350 2017] [:error] [pid 3665] [remote 41.187.94.200:84] from typing import NamedTuple [Tue Nov 28 21:26:18.349400 2017] [:error] [pid 3665] [remote 41.187.94.200:84] File"/var/www/html/mailqenv/lib/python3.4/site-packages/typing.py", line 133 [Tue Nov 28 21:26:18.349408 2017] [:error] [pid 3665] [remote 41.187.94.200:84] def __new__(cls, name, bases, namespace, *, _root=False): [Tue Nov 28 21:26:18.349412 2017] [:error] [pid 3665] [remote 41.187.94.200:84] ^ [Tue Nov 28 21:26:18.349416 2017] [:error] [pid 3665] [remote 41.187.94.200:84] SyntaxError: invalid syntax |
httpd的conf文件:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Alias /static /var/www/html/mailqueue/static <Directory /var/www/html/mailqueue/static> Require all granted </Directory> <Directory /var/www/html/mailqueue/mailqueue> <Files wsgi.py> Require all granted </Files> </Directory> <Directory /var/www/html/mailqueue> Order deny,allow Allow from all </Directory> WSGIDaemonProcess mailqueue python-path=/var/www/html/mailqueue:/var/www/html/mailqenv/lib/python3.4/site-packages WSGIProcessGroup mailqueue WSGIScriptAlias / /var/www/html/mailqueue/mailqueue/wsgi.py` |
号
os>pretty_name="Red Hat Enterprise Linux Server 7.2(maipo)"。
但是,如果我激活了我的虚拟环境并使用
我试着回答这个堆积如山的问题,但没有成功。
出现此错误是因为您的mod_wsgi是为python 2.7编译的,但您已经将它指向了python虚拟环境和代码python 3.x。python 2.7中不存在关键字only语法。
您需要安装mod wsgi,它是根据您想要使用的python 3.x版本编译的。您不能强制为一个版本编译的mod wsgi将python虚拟环境用于另一个python版本。
您可以使用签入:
- http://modwsgi.readthedocs.io/en/develop/user-guides/checking-your-installation.html
要验证编译mod wsgi的python版本。
还回顾:
- http://modwsgi.readthedocs.io/en/develop/user-guides/virtual-environments.html
关于使用mod wsgi的虚拟环境的建议方法。您当前没有使用推荐的方式。