mod_wsgi: ImportError: No module named 'encodings'

前端 未结 3 1499
伪装坚强ぢ
伪装坚强ぢ 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 01:05

    So 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.

提交回复
热议问题