big
big

Reputation: 73

Django - permission denied

I'm trying to setup Django (Django 1.9.6) on Apache (Apache 2.4.10) in my vps (ubuntu server 15.04).

I followed this guide: HERE

Unfortunately when I try to visit my website, the server return this error (403 Forbidden):`

[authz_core:error]  AH01630: client denied by server configuration: /home/user/proj/proj/wsgi.py

I searched everywhere for a solution but everything I tried didn't work.

this is my /etc/apache2/sites-available/000-default.conf file:

    Alias /static /home/user/proj/Gestione/static
    <Directory /home/user/proj/Gestione/static>
        Order deny,allow
        Allow from all
    </Directory>

    <Directory /home/user/proj/proj>
        <Files wsgi.py>
            Order deny,allow
            Allow from all
        </Files>
    </Directory>
    WSGIDaemonProcess proj python-path=/home/user/proj:/home/user/.local/lib/python3.4/site-p$
    WSGIProcessGroup proj
    WSGIScriptAlias / /home/user/proj/proj/wsgi.py

Then i found this code on /etc/apache2/apache2.conf, I don't know if this could create problems:

<Directory />
    Options FollowSymLinks
    AllowOverride None
    Require all denied
</Directory>

This is my wsgy.py:

import os
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj.settings")
application = get_wsgi_application()

I'm NOT using virtualenv

Thanks for help

Upvotes: 2

Views: 1313

Answers (1)

Alasdair
Alasdair

Reputation: 309109

In Apache 2.4, you should use Require all granted instead of Order deny,allow and Allow from all.

It looks like you are using the old style in two places in 000-default.conf. Try updating it to:

<Directory /home/user/proj/Gestione/static>
    Require all granted
</Directory>

<Directory /home/user/proj/proj>
    <Files wsgi.py>
        Require all granted
    </Files>
</Directory>

Upvotes: 1

Related Questions