jquery ajax get和flas错误500

2024-10-03 11:15:08 发布

您现在位置:Python中文网/ 问答频道 /正文

这是瓶Python:http://pastie.org/8712899

这里是索引.html模板:http://pastie.org/8712901

问题是,当通过flask内置服务器在本地运行时,它的工作方式与预期完全一致,但是在与apachewsgi一起部署时,单击search按钮会出现500个错误。在

它在这里在线(但不起作用) http://thekindlyone.scribblehead.info/calvinball/

帮忙吗?在

这是回溯记录。在

Exception on /search [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line 1817, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line 1477, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line 1381, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line 1475, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python2.6/dist-packages/flask/app.py", line 1461, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/webdev/thekindlyone/calvinball/calvinball.py", line 42, in find
    dbase=database('index')
  File "/home/webdev/thekindlyone/calvinball/calvinball.py", line 15, in __init__
    self.ix=open_dir(index_dir)
  File "/usr/local/lib/python2.6/dist-packages/whoosh/index.py", line 123, in open_dir
    return FileIndex(storage, schema=schema, indexname=indexname)
  File "/usr/local/lib/python2.6/dist-packages/whoosh/index.py", line 421, in __init__
    TOC.read(self.storage, self.indexname, schema=self._schema)
  File "/usr/local/lib/python2.6/dist-packages/whoosh/index.py", line 616, in read
    gen = cls._latest_generation(storage, indexname)
  File "/usr/local/lib/python2.6/dist-packages/whoosh/index.py", line 593, in _latest_generation
    for filename in storage:
  File "/usr/local/lib/python2.6/dist-packages/whoosh/filedb/filestore.py", line 81, in __iter__
    return iter(self.list())
  File "/usr/local/lib/python2.6/dist-packages/whoosh/filedb/filestore.py", line 518, in list
    files = os.listdir(self.folder)
OSError: [Errno 2] No such file or directory: 'index'

更新:我将whoosh索引目录路径设置为absolute,并且cnh.cbz公司绝对路径。但在那之后我还是得到了error。不过,whoosh索引的东西还是有用的。是因为cnh.cbz公司文件在flask应用程序目录之外?我怎么解决这个问题? 这是新的Python

^{pr2}$

更新2:我为cnh.cbz公司到flask应用程序目录,它就可以工作了。 但总有更好的办法。在


Tags: inpyselfappflaskindexlibpackages
1条回答
网友
1楼 · 发布于 2024-10-03 11:15:08

根据这个错误,您似乎需要使用whoosh数据库的绝对路径名,或者至少在打开当前目录之前适当地设置它。Apache似乎没有将当前目录设置为应用程序的文件夹。在

相关问题 更多 >