running django python 3.4 on mod_wsgi with apache2

荒凉一梦 提交于 2019-12-04 07:21:38
Adam Kerz

I believe that mod_wsgi is compiled against a specific version of python, so you need a py3.4 version of mod_wsgi. You may be able to get one from your os's package repository or you can build one without too much drama. From memory you'll need gcc and python-dev packages (python3-dev?) to build.

OK, quick google, for ubuntu 14.10: sudo apt-get install libapache2-mod-wsgi-py3 should install a py3 version of mod_wsgi (will probably want to remove the existing py2 version).

Adding a shebang line won't do any good as the python interpreter is already loaded before the wsgi.py script is read.

From what I see here your application is using py2 interpreter with py3 compiled modules, which is no-go.

One simple possible solution that comes me in mind is to add or change first line of manage.py to #!/usr/bin/python3. This will tell script to be interpreted with py3.

Next on guess list would be misconfiguration in *.wsgi file or apache config, whichever you are using.

Thanks guys,

I actually fixed the issue myself this morning by running the make install of mod_wsgi with .configure pointing to python3.4.

I think you were right Adam.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!