ModuleNotFoundError: No module named 'mysite.core'


I'm trying to implement Social Login in Django. I have already installed social_auth_app_django with below command

pip install social-auth-app-django 

And I have also added this to installed apps in my settings file.

INSTALLED_APPS = [ 
   'django.contrib.admin', 
   'django.contrib.auth', 
   'django.contrib.contenttypes', 
   'django.contrib.sessions', 
   'django.contrib.messages', 
   'django.contrib.staticfiles', 
   'social_django', 
   'mysite.core', 
] 

But I'm getting the following error when I try to run migration

python manage.py migrate 

ModuleNotFoundError: No module named 'mysite.core'

Note: I'm using Python 3.6.2 and Django 1.11.7


Answers:


The tutorial gets you to add views to an app mysite.core. You have added the app to INSTALLED_APPS but you haven't created it, so you get an import error.

The layout should be something like:

mysite/
├── core
│   ├── __init__.py
│   └── views.py
└── __init__.py

The mysite directory belongs in your project directory (the one containing manage.py).

Another option is to remove 'mysite.core' from INSTALLED_APPS. It isn't part of social-auth-app-django. You'll then have to adjust the parts of the tutorial that create urls/views for mysite.core.