I am able to access the static file in question via direct url (localhost:8000/static/maps/foo.txt
), so I guess I have it all working well. But I can't do the following: I want to open that text file in views.py. It's because I'm working on a simple web browser adventure game and I wanted to store maps in static/maps and load those maps using f=open('/static/maps/' + mapname + '.txt', 'r')
. I get the IOError: no such file or directory
. I really don't understand it, because there is such directory when I search for it in address.
Can it be done somehow?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…