Forums

Flask-Login Error?

I don't quite understand why I am getting this error. I created a virturalenv under: /home/myusername/.virtualenvs/myvirtualenv.

I then then did pip -install, and did flask, SQLAlchemy, and flask-login.

It says the package is installed correctly, but I can't seem to make it work? My website loads, but when I go to click the log in button, I get an internal server error?

2016-03-27 01:26:24,163 :Traceback (most recent call last):
2016-03-27 01:26:24,163 :  File "/bin/user_wsgi_wrapper.py", line 138, in __call__
2016-03-27 01:26:24,165 :    self.error_log_file.logger.exception("Error running WSGI application")
2016-03-27 01:26:24,165 :  File "/usr/lib/python3.4/logging/__init__.py", line 1310, in exception
2016-03-27 01:26:24,186 :    self.error(msg, *args, **kwargs)
2016-03-27 01:26:24,186 :  File "/usr/lib/python3.4/logging/__init__.py", line 1303, in error
2016-03-27 01:26:24,187 :    self._log(ERROR, msg, args, **kwargs)
2016-03-27 01:26:24,187 :  File "/usr/lib/python3.4/logging/__init__.py", line 1409, in _log
2016-03-27 01:26:24,188 :    self.handle(record)
2016-03-27 01:26:24,188 :  File "/usr/lib/python3.4/logging/__init__.py", line 1418, in handle
2016-03-27 01:26:24,189 :    if (not self.disabled) and self.filter(record):
2016-03-27 01:26:24,189 :  File "/usr/lib/python3.4/logging/__init__.py", line 706, in filter
2016-03-27 01:26:24,190 :    for f in self.filters:
2016-03-27 01:26:24,190 :  File "/bin/user_wsgi_wrapper.py", line 130, in __call__
2016-03-27 01:26:24,191 :    app_iterator = self.app(environ, start_response)
2016-03-27 01:26:24,191 :  File "/bin/user_wsgi_wrapper.py", line 144, in import_error_application
2016-03-27 01:26:24,191 :    raise e
2016-03-27 01:26:24,191 :  File "/bin/user_wsgi_wrapper.py", line 153, in <module>
2016-03-27 01:26:24,192 :    application = load_wsgi_application()
2016-03-27 01:26:24,192 :  File "/bin/user_wsgi_wrapper.py", line 149, in load_wsgi_application
2016-03-27 01:26:24,192 :    return __import__(os.environ['WSGI_MODULE'], globals(), locals(), ['application']).application
2016-03-27 01:26:24,192 :  File "/var/www/sailingsales_pythonanywhere_com_wsgi.py", line 16, in <module>
2016-03-27 01:26:24,195 :    from app import app as application
2016-03-27 01:26:24,196 :  File "/home/SailingSales/mysite/app.py", line 12, in <module>
2016-03-27 01:26:24,197 :    from flask.ext.login import *
2016-03-27 01:26:24,197 :  File "/usr/local/lib/python3.4/dist-packages/flask/exthook.py", line 87, in load_module
2016-03-27 01:26:24,211 :    raise ImportError('No module named %s' % fullname)
2016-03-27 01:26:24,211 :ImportError: No module named flask.ext.login

As a temporary solution, I copied the entire flask-login files from my local computer and merely pointed it to those files. Not what I wanted to do, but it works fine for the current situation and everything is back to normal.

make sure you set the virtualenv path in your webapps tab.