Hello everyone,
I’m facing this forbidden error while deploying django on apache.(MacOS to vbox Ubuntu)
You can see the file permissions here. Do you have any idea how to fix it?
Currently I am using:
- Python 3.8.8
- Apache 2.4
/etc/apache2/sites-available/django_project.conf
Alias /static/ /home/mouse/Datatables/static/
<Directory /home/mouse/Datatables/static>
Require all granted
</Directory>
Alias /media/ /home/mouse/Datatables/media/
<Directory /home/mouse/Datatables/media>
Require all granted
</Directory>
<Directory /home/mouse/Datatables/Datatables>
<Files wsgi.py>
Require all granted
</Files>
</Directory>
WSGIScriptAlias / /home/mouse/Datatables/Datatables/wsgi.py
WSGIDaemonProcess django_app python-path=/home/mouse/Datatables python-home=/home/mouse/Datatables/venv
WSGIProcessGroup django_app
/etc/apache2/apache2.conf
<Directory />
Options FollowSymLinks
AllowOverride None
Require all granted
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
/Datatables
drwxr-xr-x 7 mouse www-data 4096 feb 7 17:02 .
drwxr-x--- 7 mouse mouse 4096 feb 7 17:14 ..
-rw-r--r-- 1 mouse mouse 8196 feb 7 16:49 .DS_Store
drwxr-xr-x 6 mouse mouse 4096 feb 7 16:49 App
drwxr-xr-x 3 mouse mouse 4096 feb 7 17:13 Datatables
-rw-r--r-- 1 mouse mouse 68 feb 7 16:49 fernet_key.py
-rwxr-xr-x 1 mouse mouse 666 feb 7 16:49 manage.py
drwxrwxr-x 3 mouse www-data 4096 feb 7 16:49 media
-rw-r--r-- 1 mouse mouse 645 feb 7 16:58 requirements.txt
drwxrwxr-x 5 mouse mouse 4096 feb 7 17:02 static
drwxrwxr-x 5 mouse mouse 4096 feb 7 16:56 venv
/Datatables/Datatables
drwxr-xr-x 3 mouse mouse 4096 feb 7 17:13 .
drwxr-xr-x 7 mouse www-data 4096 feb 7 17:02 ..
-rw-r--r-- 1 mouse mouse 6148 feb 7 16:49 .DS_Store
-rw-r--r-- 1 mouse mouse 121 feb 7 16:49 __init__.py
drwxr-xr-x 2 mouse mouse 4096 feb 7 17:01 __pycache__
-rw-r--r-- 1 mouse mouse 397 feb 7 16:49 asgi.py
-rw-r--r-- 1 mouse mouse 4583 feb 7 17:13 settings.py
-rw-r--r-- 1 mouse mouse 2202 feb 7 16:49 urls.py
-rw-r--r-- 1 mouse mouse 397 feb 7 16:49 wsgi.py
sudo tail -100 /var/log/apache2/error.log
[Wed Feb 08 10:58:10.292907 2023] [wsgi:warn] [pid 87724:tid 139790940960640] (13)Permission denied: mod_wsgi (pid=87724): Unable to stat Python home /home/mouse/Datatables/venv. Python interpreter may not be able to be initialized correctly. Verify the supplied path and access permissions for whole of the path.
Python path configuration:
PYTHONHOME = ‘/home/mouse/Datatables/venv’
PYTHONPATH = (not set)
program name = ‘python3’
isolated = 0
environment = 1
user site = 1
import site = 1
sys._base_executable = ‘/usr/bin/python3’
sys.base_prefix = ‘/home/mouse/Datatables/venv’
sys.base_exec_prefix = ‘/home/mouse/Datatables/venv’
sys.platlibdir = ‘lib’
sys.executable = ‘/usr/bin/python3’
sys.prefix = ‘/home/mouse/Datatables/venv’
sys.exec_prefix = ‘/home/mouse/Datatables/venv’
sys.path = [
‘/home/mouse/Datatables/venv/lib/python310.zip’,
‘/home/mouse/Datatables/venv/lib/python3.10’,
‘/home/mouse/Datatables/venv/lib/python3.10/lib-dynload’,
]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named ‘encodings’