File not found on pythonanywhere.com
问题 On pythonanywhere.com I have a django app. This is views.py : def literature(request): module_dir = os.path.dirname(__file__) file_path = os.path.join(module_dir, 'literature.csv') with open(file_path, 'r') as f: ... File literature.csv is located at the same directory as views.py. But every time when I try to load the page I get FileNotFoundError . The same construction works normally on local server. Where is the bug? 回答1: This os.path.dirname(__file__) is giving you a relative path. On