Forums

from flask_wtf import FlaskForm issue

I made an app and tested it locally and it works fine. I'm trying to see if I can deploy it with pythonanywhere but I keep running into this issue - log says:

2018-06-29 17:14:39,281: Error running WSGI application
2018-06-29 17:14:39,285: ImportError: cannot import name FlaskForm
2018-06-29 17:14:39,286:   File "/var/www/gman_pythonanywhere_com_wsgi.py", line 81, in <module>
2018-06-29 17:14:39,286:     from app_runner import app as application  # noqa
2018-06-29 17:14:39,286: 
2018-06-29 17:14:39,286:   File "/home/Gman/deploy/app_runner.py", line 2, in <module>
2018-06-29 17:14:39,286:     from app import app
2018-06-29 17:14:39,287:   File "/home/Gman/deploy/app/__init__.py", line 15, in <module>
2018-06-29 17:14:39,287:     from app import routes, models
2018-06-29 17:14:39,287:   File "/home/Gman/deploy/app/routes.py", line 5, in <module>
2018-06-29 17:14:39,287:     from app.forms import RegistrationForm, LoginForm, DoctorForm,                         
2018-06-29 17:14:39,287:   File "/home/Gman/deploy/app/forms.py", line 1, in <module>
2018-06-29 17:14:39,287:     from flask_wtf import FlaskForm

I'm not sure why this is happening. Any ideas?

Are you using the correct version of flask_wtf. Make sure that the versions agree between your local environment and your PythonAnywhere environment.

I realized I was looking at the top of the log page instead of bottom for new error logs lol...thank you!

Follow up question: I am installing packages and cannot seem to get sklearn and scikit_learn-0.19.1-py2.7.egg-info to install on virtualenv via pip. Is there any other way? Please help thanks!

No, pip is the way to install things, though scikit_learn-0.19.1-py2.7.egg-info is not a package name, so I'm not surprised that it doesn't install. Look up the package names for the packages you want to install. They will usually be on the packages website or listed on PyPI.

Sorry that was vague - I'm a newbie. When I run the app I get this error:

2018-07-03 16:33:33,483: Error running WSGI application
2018-07-03 16:33:33,493: ImportError: No module named sklearn.feature_extraction.text
2018-07-03 16:33:33,493:   File "/var/www/geman_pythonanywhere_com_wsgi.py", line 80, in <module>
2018-07-03 16:33:33,493:     from app_runner import app as application  # noqa
2018-07-03 16:33:33,493: 
2018-07-03 16:33:33,493:   File "/home/geman/deploy/app_runner.py", line 2, in <module>
2018-07-03 16:33:33,493:     from app import app
2018-07-03 16:33:33,494: 
2018-07-03 16:33:33,494:   File "/home/geman/deploy/app/__init__.py", line 15, in <module>
2018-07-03 16:33:33,494:     from app import routes, models
2018-07-03 16:33:33,494: 
2018-07-03 16:33:33,494:   File "/home/geman/deploy/app/routes.py", line 10, in <module>
2018-07-03 16:33:33,494:     from docter_core import ESC_Excel, TE_Excel, ML_Excel
2018-07-03 16:33:33,494: 
2018-07-03 16:33:33,494:   File "/home/geman/deploy/app/docter_core/ESC_Excel.py", line 14, in <module>
2018-07-03 16:33:33,495:     from sklearn.feature_extraction.text import TfidfVectorizer

I tried to pip install sklearn but got an exception:

Exception:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File ......

I'm very new to this and making a lot of rookie mistakes. The problem was that I was not in the virtual env directory. Thanks for you attention to this!

Glad to help -- is everything working OK now?

yep everything is working perfectly! thanks for checking!

:-)