我开始学习如何在pythonanywhere工作,所以我有一些问题... 我的web应用程序的结构为:烧瓶pythonanywhere服务器中的文件结构?
/home/mentor/mysite/servidor/ here I've run.py and the folder app
inside app there's init.py , views.py and the folders: static,scripts,templates
我的问题是,在网络里面有一种形式,当有人点击按钮,在views.py中调用脚本中的函数。该功能需要读取.csv文件(我将该文件保存在.../servidor /中)。
但网页不运行,它返回500内部服务器错误,因为OSError:文件b'Names.csv'不存在。 为什么我可以解决这个问题?我需要放置该文件的位置?这是run.py或WSGI配置文件的问题吗?
谢谢!
PD:该代码
在viwes.py:
from .scripts.file import function
@app.route('/func', methods=['POST'])
def resp():
l=[request.form['d1'].....]
f=function(l)
.....
在脚本文件夹file.py:
import pandas as pd
def function(l):
df=pd.read_csv('Names.csv') #Here is the problem!
.....
您能否包含访问该文件的代码? –
@Luis Orduz,我只是把它写下来,没关系?还是你想再看? –