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

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -