mod_wsgi: ImportError: No module named 'encodings'

前端 未结 3 1500
伪装坚强ぢ
伪装坚强ぢ 2020-12-06 00:42

I\'m using Apache 2.2.15 on CentOS 6.5. I\'m trying to set up a Django app using mod_wsgi. I\'m using a virtual environment, and mod_wsgi was configured with --with-py

3条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-06 00:52

    The issue was caused by SELinux. What I did was this:

    • moved the project files into /home/admin/myproject
    • changed permissions as in FlipperPA's answer
    • and, crucially I think, set the httpd_enable_homedirs SELinux boolean to on using setsebool -P httpd_enable_homedirs on.

    The SELinux guide on the CentOS wiki was very helpful. For example, to debug you can run setenforce Permissive so SELinux won't enforce its rules, but still write to the log. Just remember to setenforce Enforcing again afterwards!

提交回复
热议问题