Report this

What is the reason for this report?

How do I assign the correct permissions to create directories in a Dokku/Django droplet?

Posted on September 25, 2017

I’m trying to use the Google Sheets API in my Django application and it works in my testing environment. When I push to my Dokku droplet, I get a 502 Bad Gateway Nginx error and upon further digging, I believe it’s timing out on this line:

home_dir = os.path.expanduser(‘~’)

credential_dir = os.path.join(home_dir, ‘.credentials’) if not os.path.exists(credential_dir): os.makedirs(credential_dir)

The above code should look for a directory and if it’s not present, then create it.

The os.path.expanduser(‘~’) returns the value of the HOME environment variable and in my test environment is “/var/username”, but in the Dokku droplet, it returns “/app”. That may be the problem as well, but right now, I can’t even locate the directory to assign write permissions to.

Any help is much appreciated!



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!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.