The error code is saying that it is trying to do relative import and it cannot find the file _wsgi_encoding_dance in the _internal folder within the site-packages/werkzeug package.
Check the package requirements and make sure to install the correct package dependency versions.
Answer from anonymous on Stack OverflowSo with some help with my friends (IE: SysAdmins), we got this figured out last night. I learn best by example, so let's assume you're running Apache with mod_wsgi as Linux group apache with user flipperpa. Let's assume you're hosting in /home/my_project with wsgi.py in my_project/wsgi.py.
At the top level (ls -l /):
drwxr-xr-x. 47 root root 4096 Jul 9 09:43 home
In the home directory (ls -l /home):
drwxrwsr-x 7 flipper apache 4096 Jul 29 10:22 my_project
This was the key. The lower case "s" means the apache group's setgid bit is set, and the execute bit is set. The final "x", of course, means anyone can execute.
Check your permissions down the tree; this did the trick for us.
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_homedirsSELinux boolean toonusingsetsebool -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!