[Answer]-Client denied by server configuration

1👍

I solved the problem by making two changes :
1) Require all denied -> change this to -> Require all granted
2) If you look at the project created by you there is already a wsgi.py file in you project directory (same dir where your settings are placed by default) , So you do not have to create seperate wsgi file as I have created initially. Just point to that wsgi.py in your conf file inside apache2 as

WSGIScriptAlias / /<path to my-project wsgi.py file>

That’s it you error is resolved. But still if you are getting one more error after this your settings module is not find then you have to edit your wsgi file and add two lines of code :

import sys
sys.path = ['<path to my project>'] + sys.path

That’s it your project will run smoothly now.

So complete wsgi and conf files will look like this :

wsgi.py file :

import os
import sys

sys.path = ['<path to my project>'] + sys.path
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "conf.settings")

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

and conf file :

<VirtualHost *:80>
WSGIScriptAlias / /<path to my project>/wsgi.py

ServerName secondweb.com
ServerAlias secondweb.com

Alias /static/ /<path to my project>/static/
<Directory /<path to my project>/ >
            Options Indexes FollowSymLinks
            Require all granted
</Directory>
</VirtualHost>

Leave a comment