Question

Mod_wsgi (19) Permission denied while deploying a django application using Apache

Hello guys, I am quite new to Linux so your help and patience is very much appreciated.

I have been trying to deploy a django website on an Ubuntu instance. I have successfully setup an apache configuration file, and then removed the secret token from the settings.py file in the django project, putting it somewhere safe. When I tried to check if my website was working, it gave me this error in apache error.log file:

https://prnt.sc/_rv3zM3Z0K5x

I have checked the configuration file to make sure that the path was the correct the one. I am sharing a screenshot of that apache configuration as well for reference:

https://prnt.sc/x3vMom5VyIM2

I have tried running chown and chmod on both the venv in that directory and also on the main directory. I also ran ls -la to see if the permissions are correct as shown in this screenshot:

https://prnt.sc/eRfj0b1DOQj-

Unfortunately, as I am still a beginner, I couldn’t have figured out what the next steps should be. I did try looking at stack overflow and different articles, but a lot of them are not very specific to the issue I am facing.

Your help and guidance would be much appreciated, thank so much in advance for it.


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
August 17, 2022

Hi @fliper05,

Most likely the issue is coming from filesystem permissions with Apache user unable to read from where the WSGI script file is or read the WSGI script file itself.

This specific error is described in the presentation:

http://code.google.com/p/modwsgi/wiki/WhereToGetHelp?tm=6#Conference_Presentations

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel