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!