chamkank / flask-chatterbot

Simple boilerplate for ChatterBot using Flask
377 stars 263 forks source link

I can't deploy it into PythonAnywhere #11

Closed diegonatalo closed 6 years ago

diegonatalo commented 6 years ago

I tried to implement the chatbot in pythonanywhere, but I'm not getting it. I have already installed Flask, Chatterbot and SQLAlchemy and nothing. I have already edited the WSGI file, removing the app.run and nothing. I do not know how to fix this. Please help me.

Thank you.

gunthercox commented 6 years ago

@KernelDN Does PythonAnywhere provide you with a way to access error logs for your application?

diegonatalo commented 6 years ago

@gunthercox ERROR LOG:

2018-02-05 14:25:32,569: Error running WSGI application 2018-02-05 14:25:32,593: sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) cannot change into wal mode from within a transaction (Background on this error at: http://sqlalche.me/e/e3q8) 2018-02-05 14:25:32,594: File "/var/www/kerneldn_pythonanywhere_com_wsgi.py", line 16, in

gunthercox commented 6 years ago

The part of the stack trace that stands out to me is:

sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) cannot change into wal mode from within a transaction

The help document related to this message http://sqlalche.me/e/e3q8 suggests that this error was likely triggered because your chat bot couldn't connect to your database.

diegonatalo commented 6 years ago

Could you help me solve this problem? I have everything ready and just need to make it work in pythonanywhere. I have plans to use this bot in my TCC (course completion work).

Thanks in advance

chamkank commented 6 years ago

Hey @KernelDN, sorry for the delay in response. I just tried to create a new instance of flask-chatterbot on PythonAnywhere and I ran into the exact same error as you.

Currently what you can do to fix your error is downgrade your version of the chatterbot package. To do this with your current setup, you can first change the line chatterbot>=0.8.4 to chatterbot==0.7.4 in the file requirements.txt. You can do this directly via the Files tab.

After you've done that, you can perform the following steps:

  1. Create/open a Bash console on PythonAnywhere and change directory into the project folder (ex: cd flask-chatterbot)
  2. Use pip3 uninstall chatterbot to uninstall the chatterbot package.
  3. Use pip3 install --user -r requirements.txt to install the older chatterbot package.

Now head over to the Web tab (you should have already created a web app through this interface) and press the reload button. It should work after that.

Let me know if you have problems with the steps above!

diegonatalo commented 6 years ago

It still has the same error. I checked the error file and nothing has changed. Sorry for not taking time to submit my feedback.

chamkank commented 6 years ago

In that case your configuration must be different somehow. I've created a quick video tutorial to show you how to setup flask-chatterbot to work on a brand new account on PythonAnwhere:

https://youtu.be/VP0HvbunaRo

Hope this helps, let me know if you have any other issues!

diegonatalo commented 6 years ago

I followed your tutorial and it worked, but when I replace the index.html, style.css and app.py files, it still displays the same error. I believe there is something wrong with my app.py file, but I could not debug.

chamkank commented 6 years ago

Are you sure it's the same error? The error log builds up instead of refreshing each time, your latest errors will be at the bottom of the error log.

I just checked out your fork of the project and found the issue:

Instead of bot.train("./corpus/"), use the absolute file path beginning at your user directory.

So for example, if the full path to the corpus folder was /home/testingacc/mybot/My Fork/corpus then you would replace the line with:

bot.train("mybot/My Fork/corpus")

Then refresh the web app and it should work, let me know how it goes.

diegonatalo commented 6 years ago

I made the change in the path of the corpus folder and everything worked perfectly. Thanks a lot for the help.

stewchicken commented 6 years ago

all questions and answers are just online sentences. could i make them as multiple lines?

shivalikabcd commented 5 years ago

By following below steps still, have an error of package of chatterbot not found, please check it in the screenshot. chatterbot not installed


After you've done that, you can perform the following steps:

Create/open a Bash console on PythonAnywhere and change directory into the project folder (ex: cd flask-chatterbot) Use pip3 uninstall chatterbot to uninstall the chatterbot package. Use pip3 install --user -r requirements.txt to install the older chatterbot package.