Django, mod_wsgi and apache2.4 = 403 forbidden

35 views
Skip to first unread message

Rookies DJ

unread,
Jan 29, 2019, 2:42:22 AM1/29/19
to Django users
I'm sorry if I'm asking the repetitive but i really need assistance I been trying to setup a server for my company system but I had no progress. 

As the tile subject mention the I'm Using Mod_wsgi 4.6.5 and Apache 2.4

for my Django is 2.1 and python 3.7

When try to run on my local machine I get 403 and I did many google search and the only answer I get is add in Require all granted which I had already add in. you could see below for particle section for my Apache http

LoadModule wsgi_module "C:\users\user\appdata\local\programs\python\python37\lib\site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd"
WSGIScriptAlias / "C:\Frontier_Website\FrounterWebApp\FrounterWeb\wsgi.py"\
WSGIPythonPath "C:\Frontier_Website\FrounterWebApp\zigview"
WSGIPythonHome "C:\Users\user\AppData\Local\Programs\Python\Python37"

<Directory C:\Frontier_Website\FrounterWebApp\zigview\static>
Require all granted
</Directory>

<Directory C:\Frontier_Website\FrounterWebApp\FronterWeb>
<Files wsgi.py>
Require all granted
</Files>
</Directory>


for more detail you can look at at code in stackoverflow.com:
 
  
I had try to run the system in virtualenv but I get no result as well and when I try to start the server, I get this error: The system cannot find the path specified.
The virtualenv code is below;

#python and mod_wsgi setting 
<VirtualHost *:86>
 ServerName Localhost.com 
 DocumentRoot C:\Frontier_Website\FATWebsite\FrontierWebApp\zigview\templates\FrounterWeb
LoadModule wsgi_module C:\users\user\appdata\local\programs\python\python37\lib\site-packages/mod_wsgi/server/mod_wsgi.cp37-win_amd64.pyd
WSGIScriptAlias / C:\Frontier_Website\FATWebsite\FrontierWebApp\FrounterWeb\wsgi.py
WSGIPythonHome C:\Frontier_Website\FATWebsite\Lib
WSGIPythonPath C:\Frontier_Website\FrounterWebApp\zigview

Alias /static \Frontier_Website\FATWebsite\FrounterWebApp\zigview\static
<Directory C:\Frontier_Website\FATWebsite\FrounterWebApp\zigview\static>
Require all granted
</Directory>

<Directory C:\Frontier_Website\FATWebsite\FrounterWebApp\FronterWeb\wsgi-script>
<Files wsgi.py>
   Require all granted
</Files>

</Directory>
</VirtualHost> 
 
Please help I had been trying to solve this problem for month now

Mohammad Etemaddar

unread,
Jan 29, 2019, 5:17:34 AM1/29/19
to Django users
I have no experience in configure apache. But these two lines have conflict.

    DocumentRoot C:\Frontier_Website\FATWebsite\FrontierWebApp\zigview\templates\FrounterWeb
and:
    WSGIScriptAlias / C:\Frontier_Website\FATWebsite\FrontierWebApp\FrounterWeb\wsgi.py

Both of these lines tell apache how to handle the /
But for the first one you did not grant access to it's folder and you shouldn't
So you should remove the first line. I mean DocumentRoot. You do not need it when you are configure your django site at root ( / )
Reply all
Reply to author
Forward
0 new messages