0

I have looked here for answers to this error: mod_wsgi: ImportError: No module named 'encodings'

and it seems i get this error because of permissions not being set. But to me it looks like all of the permissions are set correctly

Here is my file structure:

home
└── user
    └── projects
        └── myapp
            ├── app
            │   ├── <All Code for Webapp including static dir>  
            ├── env (virtualenv)
            ├── manage.py
            ├── new
            │   ├── settings.py
            │   ├── urls.py
            │   └── wsgi.py
            └── requirements.txt

Here is my wsgi.conf file located in /etc/httpd/conf.d

Alias /static /home/user/projects/myapp/app/static
<Directory /home/user/projects/myapp/app/static>
    Require all granted
</Directory>

<Directory /home/user/projects/myapp/new>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

WSGIDaemonProcess myapp python-path=/home/user/projects/myapp python-home=/home/user/projects/,myapp/env/lib/python3.6/site-packages user=<user>
WSGIProcessGroup myapp
WSGIScriptAlias / /home/user/projects/myapp/new/wsgi.py

Now here are what the permissions say when i'm in my home directory:

/home

$ ls -l 
total 0
drwxrwxr-x. 5 <user> <group> 41 Mar  7 14:53 project

this permission is the same down to projects, now my permissions when i get the myapp directory are as follows:

/home/user/myapp

drwxrwxr-x. 7 <user> <group> 4096 Mar  7 13:18 app
drwxrwxr-x. 5 <user> <group>   56 Mar  7 14:42 env
-rwxrwxr-x. 1 <user> <group>  535 Mar  5 13:33 manage.py
drwxrwxr-x. 3 <user> <group>  110 Mar  7 14:27 new
-rw-rw-r--. 1 <user> <group>  869 Mar  7 14:42 requirements.txt

and the permission where the wsgi.py file is located (under new) is :

/home/user/myapp/new

-rw-rw-r--. 1 <user> <group>    0 Mar  5 13:33 debug.log
-rw-rw-r--. 1 <user> <group>    0 Mar  5 13:33 __init__.py
drwxrwxr-x. 2 <user> <group>  122 Mar  9 03:00 __pycache__
-rw-rw-r--. 1 <user> <group> 5442 Mar  8 10:17 settings.py
-rw-rw-r--. 1 <user> <group>  790 Mar  5 13:33 urls.py
-rw-rw-r--. 1 <user> <group>  383 Mar  5 13:33 wsgi.py

Are these the correct permissions to have when running mod_wsgi with apache?

NOTE : user and group in the above are the same, and is my name

Mfreeman
  • 3,548
  • 7
  • 23
  • 37

1 Answers1

0

Check the python version used to configure mod_wsgi and the one your project is compiled against ( virtual env) , I got this error when they were different.