GAE: ImportError while using google-auth

Viewed 1068

I am using google-auth to allow firebase authentication in my GAE project.

Everything works fine when I run the code locally using dev_appserver.py or when I deploy it to google app engine.

But I get this ImportError exceptions when I try to use Django's manage.py script to create/run migrations.

ImportError: Could not import 'firebase.authentication.FirebaseAuthentication' for API setting 'DEFAULT_AUTHENTICATION_CLASSES'. ImportError: No module named auth.transport.requests.

The google-auth module is installed under lib directory and has this structure:

- lib - google - auth - oauth2

These import cause the ImportErrors:

import google.auth.transport.requests
from google.oauth2 import id_token

My guess is that there might be naming conflicts as other imports work fine.

Please help!

1 Answers

If you want to use 3rd party libraries that are not included in this list, then you'll have to add them manually since you have done that by adding lib folder and including all the package folder follow these steps.

Create your_app_directory/appengine_config.py file.

Add these following lines inside that file

from google.appengine.ext import vendor
vendor.add('lib')

This should solve the import error problem.

Related