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.

edited by asb

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.

×
1 answer

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:

Submit an Answer