使用 wsgi 脚本托管聊天机器人的 Flask 应用程序出错 [sqlite3.OperationalError) 无法打开数据库文件]
error when flask app with chatter bot hosted with a wsgi script [sqlite3.OperationalError) unable to open database file]
我正在使用 Ubuntu 16.04 服务器,我创建了一个烧瓶应用程序并使用 apache_wsgi 脚本托管。
个别地。
我的 python 文件如下
chatbot = ChatBot(
'Dan',
storage_adapter="chatterbot.storage.SQLStorageAdapter"
)
chatbot.set_trainer(ChatterBotCorpusTrainer)
chatbot.train(`
`"chatterbot.corpus.english.greetings"
)
def chat(text):
response = chatbot.get_response(text)
if response.confidence >= 0.8:
return response
else:
pass
当我 运行 它单独时它是 运行ning 但是当我使用 flask 应用程序时它给出了一个错误。
错误日志我已经放上了
[client 71.6.232.4:41358] sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/e3q8)
我已经找到了解决办法。这个问题主要有两种解决方案。
- 授予文件权限
sudo chomd -R 777 db.sqlite3
- 给 apache_wsgi 作为当前 ubuntu 用户名执行
user=name 使用以下 reference
我正在使用 Ubuntu 16.04 服务器,我创建了一个烧瓶应用程序并使用 apache_wsgi 脚本托管。 个别地。 我的 python 文件如下
chatbot = ChatBot(
'Dan',
storage_adapter="chatterbot.storage.SQLStorageAdapter"
)
chatbot.set_trainer(ChatterBotCorpusTrainer)
chatbot.train(`
`"chatterbot.corpus.english.greetings"
)
def chat(text):
response = chatbot.get_response(text)
if response.confidence >= 0.8:
return response
else:
pass
当我 运行 它单独时它是 运行ning 但是当我使用 flask 应用程序时它给出了一个错误。
错误日志我已经放上了
[client 71.6.232.4:41358] sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/e3q8)
我已经找到了解决办法。这个问题主要有两种解决方案。
- 授予文件权限
sudo chomd -R 777 db.sqlite3
- 给 apache_wsgi 作为当前 ubuntu 用户名执行 user=name 使用以下 reference