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!

The developer cloud

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

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.