The problem i’m facing is simple to present. I hope its solution is simple too.
I created my droplet with the django onclick installation. Worked perfect. I uploaded my own project, and got it working by tweaking the /etc/init/gunicorn.conf file accordingly to match my project python path and name. That also works.
Now, when I upload a file, via my views or using django admin, I get,
[Errno 13] Permission Denied
Did some reading (lots of them), figured how to check, (is it the group?) my directories. I compared the django_project folder with mine, and there are differences
Running
ls -lha
on /django_project/django_project gives
drwxr-xr-x 3 django django 4.0K Jan 14 10:42 .
drwxr-xr-x 3 django django 4.0K Jan 14 10:42 ..
drwxr-xr-x 2 django django 4.0K Jan 29 15:11 django_project
-rw-r--r-- 1 django django 257 Jan 14 10:42 manage.py
Running same command in my project folder gives me:
drwxr-xr-x 14 root root 4.0K Jan 31 17:13 .
drwxr-xr-x 5 root root 4.0K Jan 31 17:13 ..
drwxr-xr-x 4 root root 4.0K Jan 31 17:13 blog
drwxr-xr-x 3 root root 4.0K Jan 31 17:13 CACHE
drwxr-xr-x 4 root root 4.0K Jan 31 17:13 central
drwxr-xr-x 4 root root 4.0K Jan 31 17:13 commonsconvert
drwxr-xr-x 2 root root 4.0K Jan 31 17:13 Dummy
-rw-r--r-- 1 root root 2.2K Jan 31 17:13 fabfile.py
drwxr-xr-x 8 root root 4.0K Jan 31 17:13 .git
-rw-r--r-- 1 root root 62 Jan 31 17:13 .gitignore
-rwxr-xr-x 1 root root 252 Jan 31 17:13 manage.py
drwxr-xr-x 4 root root 4.0K Jan 31 17:13 placeholder
drwxr-xr-x 2 root root 4.0K Jan 31 17:13 Portfolio
drwxr-xr-x 4 root root 4.0K Jan 31 17:13 quickapi
-rw-r--r-- 1 root root 81 Jan 31 17:13 requirements.txt
drwxr-xr-x 10 root root 4.0K Jan 31 17:13 static
drwxr-xr-x 4 root root 4.0K Jan 31 17:13 threeD
drwxr-xr-x 4 root root 4.0K Jan 31 17:13 wikitips
Question: How do I get gunicorn to have write access to my own project folder? Does it need to be in the django (group?) or what?
Please help.
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!
Gunicorn runs as the django user. So the files for your application need to be accessible to by that user. You can change the owner by running:
- sudo chown -R django:django /path/to/app
For more details on how the Django One-Click app is configured, see:
Hello all,
It’s already been described as an ownership issue. What I’ll recommend is to create a user and assign the needed groups. That way you can have more than one app, with different users without them having the same ownerships.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.