python - Cannot access file on pythonanywhere -


i have django project worked on local server returning response. trying run on pythonanywhere, keeps saying no such directory or file. used os.path.dirname("__file__") changed absolute address, i.e. "/home/username/projectname/filename" no avail. latter method 1 others on web suggesting, still isn't working. there special syntax access files in pythonanywhere? or have suggestions? thanks.

the following line throws error:

with open("home/<username>/<project>/layer.pem", "r") rsa_priv_file: 

directory structure: directory structure

if with open("home/<username>/<project>/layer.pem", "r") rsa_priv_file: actual code you're using, you're missing / @ beginning. you're asking code not absolute path layer.pem, relative path rooted in current directory.

also, os.path.dirname("__file__") not working because quoted __file__. you're asking dirname of file called "__file__" (which empty string), not dirname of current file.


Comments

Popular posts from this blog

Hard vs. Soft Water: What's The Difference?

java - Solr query version issue: Invalid version or the data in not in 'javabin' format -

The Ten Most Livable Cities In The World