我在一个 python 文件中有一个瓶子应用程序 - backend.py。该文件包含以下定义:
variable = {
'field': [f for f in csv.DictReader(open('../data/fields.csv', 'rb'), delimiter=';')]
}
def run_fcgi():
from bottle import FlupFCGIServer
run(port=8080, server=FlupFCGIServer)
if __name__ == "__main__":
run(host='0.0.0.0', port=8087, server='waitress')
当我像这样运行这个应用程序时:
python backend.py
应用程序启动成功。
当我由主管将此应用程序作为 fcgi 应用程序 (fcgi.py) 运行时:
#!my_path_to_python
if __name__ == '__main__':
import backend
backend.run_fcgi()
我有一个错误:
Traceback (most recent call last):
File "path_to_my_project/fcgi.py", line 9, in <module>
import backend
File "path_to_my_project/backend.py", line 49, in <module>
'msk': [i for i in csv.DictReader(open('../data/fields.csv', 'rb'), delimiter=';')],
IOError: [Errno 2] No such file or directory: '../data/fields.csv'
有任何想法吗?