Forums

ImportError: No module named flask_oauth

I have a question about Flask-OAuth extension https://pythonhosted.org/Flask-OAuth/.

Is this extension included in the PaythonAnywhere? I have created a working OAuth authorization with Facebook on my local DEV environment, but after uploading my code to the PythonAnywhere, I get an error: ImportError: No module named flask_oauth

Error is from the line where I import OAuth extension:

from flask_oauth import OAuth

Are you using a virtualenv? If you are, you need to install flask-oauth within your virtualenv. (activate your virtualenv and run pip install flask-oauth). Also make sure your webapp is running with the virtualenv.

Otherwise, run pip install --user flask-oauth from a bash console to install it.

Thanks for the quick response! Earlier I tried to install without the "--user" parameter and of course the installation failed. Now with "pip install --user flask-oauth" everything installed, and the code works.

Thank You

Hello, hope this isn't a bother. I am trying to use flask-oauth with google signin on my app. Have you been able to get this to work for you? If so are you doing oogle sign in also?

Thanks!

Following the guidelines posted here https://pythonhosted.org/Flask-OAuth/ I have created authorization for my website only for Facebook OAuth. And, yes, everything works fine. Unfortunately I have no need for Google Sign-in for my website, so I can't comment if this is working for Google also.

Ah ok thanks for the response. I havent used facebook yet, but that is a good test case for me as an alternative. I have used that guideline originally, and it works for google sign in for me locally. It just stops working here for some reason. Will investigate and update my other thread here at https://www.pythonanywhere.com/forums/topic/2267/ if it works.

I was able to get google oauth working with a free account. For anyone facing problems with this in the future, there are a couple things to note.

  1. setup your auth configs on the google developers console first otherwise it won't work. In particular, you need to set your redirect URIs and javascript origins for your pythonanywhere domain/endpts, otherwise google will just block you.

  2. as of the time of writing this, I think flask-oauth does not work with python3. So either use python2 or write your own code...