# Model class allauth.account.models.EmailAddress doesn't declare an explicit app\_label and isn't in an application in INSTALLED\_APPS

**URL:** <https://forum.djangoproject.com/t/model-class-allauth-account-models-emailaddress-doesnt-declare-an-explicit-app-label-and-isnt-in-an-application-in-installed-apps/34700>\
**Category:** Getting Started\
**Created:** [September 11, 2024, 9:34am UTC](https://forum.djangoproject.com/t/model-class-allauth-account-models-emailaddress-doesnt-declare-an-explicit-app-label-and-isnt-in-an-application-in-installed-apps/34700 "2024-09-11T09:34:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![kirankthota79](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kirankthota79/32/23840_2.png) [@kirankthota79](https://forum.djangoproject.com/u/kirankthota79)\
**Post date:** [September 11, 2024, 9:34am UTC](https://forum.djangoproject.com/t/model-class-allauth-account-models-emailaddress-doesnt-declare-an-explicit-app-label-and-isnt-in-an-application-in-installed-apps/34700/1 "2024-09-11T09:34:34Z")

</div>

Hi All,  
I’m pretty much new to Django and Python. Trying to build a Web Application and currently Stuck at below error can someone please guide on resolving this.

> python manage.py runserver  
> Watching for file changes with StatReloader  
> Performing system checks…
> 
> Exception in thread django-main-thread:  
> Traceback (most recent call last):  
> File “/Users/Kiran.Thota/.pyenv/versions/3.10.2/lib/python3.10/threading.py”, line 1009, in \_bootstrap\_inner  
> self.run()  
> File “/Users/Kiran.Thota/.pyenv/versions/3.10.2/lib/python3.10/threading.py”, line 946, in run  
> self.\_target(\*self.\_args, \*\*self.\_kwargs)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/utils/autoreload.py”, line 64, in wrapper  
> fn(\*args, \*\*kwargs)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/core/management/commands/runserver.py”, line 134, in inner\_run  
> self.check(display\_num\_errors=True)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/core/management/base.py”, line 486, in check  
> all\_issues = checks.run\_checks(  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/core/checks/registry.py”, line 88, in run\_checks  
> new\_errors = check(app\_configs=app\_configs, databases=databases)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/core/checks/urls.py”, line 16, in check\_url\_config  
> return check\_resolver(resolver)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/core/checks/urls.py”, line 26, in check\_resolver  
> return check\_method()  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/urls/resolvers.py”, line 531, in check  
> for pattern in self.url\_patterns:  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/utils/functional.py”, line 47, in **get**  
> res = instance. **dict** [self.name] = self.func(instance)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/urls/resolvers.py”, line 718, in url\_patterns  
> patterns = getattr(self.urlconf\_module, “urlpatterns”, self.urlconf\_module)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/utils/functional.py”, line 47, in **get**  
> res = instance. **dict** [self.name] = self.func(instance)  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/urls/resolvers.py”, line 711, in urlconf\_module  
> return import\_module(self.urlconf\_name)  
> File “/Users/Kiran.Thota/.pyenv/versions/3.10.2/lib/python3.10/importlib/ **init**.py”, line 126, in import\_module  
> return \_bootstrap.\_gcd\_import(name[level:], package, level)  
> File “”, line 1050, in \_gcd\_import  
> File “”, line 1027, in \_find\_and\_load  
> File “”, line 1006, in \_find\_and\_load\_unlocked  
> File “”, line 688, in \_load\_unlocked  
> File “”, line 883, in exec\_module  
> File “”, line 241, in \_call\_with\_frames\_removed  
> File “/Applications/Training/Project\_Amplify/quiz/quiz/urls.py”, line 21, in   
> from PyQuiz import views  
> File “/Applications/Training/Project\_Amplify/quiz/PyQuiz/views.py”, line 3, in   
> from .forms import UserUpdateForm, profileUpdateForm, UserLoginForm, UserRegisterForm  
> File “/Applications/Training/Project\_Amplify/quiz/PyQuiz/forms.py”, line 4, in   
> from allauth.account.forms import LoginForm  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/allauth/account/forms.py”, line 11, in   
> from allauth.account.internal import flows  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/allauth/account/internal/ **init**.py”, line 1, in   
> from allauth.account.internal import flows  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/allauth/account/internal/flows/ **init**.py”, line 1, in   
> from allauth.account.internal.flows import (  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/allauth/account/internal/flows/email\_verification.py”, line 9, in   
> from allauth.account.models import EmailAddress  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/allauth/account/models.py”, line 23, in   
> class EmailAddress(models.Model):  
> File “/Applications/Training/Project\_Amplify/venv/lib/python3.10/site-packages/django/db/models/base.py”, line 134, in **new**  
> raise RuntimeError(  
> RuntimeError: Model class allauth.account.models.EmailAddress doesn’t declare an explicit app\_label and isn’t in an application in INSTALLED\_APPS.

Below is the code:

**forms.py**

> from django import forms  
> from django.contrib.auth.forms import UserCreationForm, UserChangeForm  
> from .models import User, Profile, Address  
> from allauth.account.forms import LoginForm
> 
> class CustomCreationForm(UserCreationForm):
> 
> ```
> class Meta:
> model = User
> fields = ("username", "email")
> app_label = "PyQuiz"
> 
> ```
> 
> class CustomUserChangeForm(UserChangeForm):
> 
> ```
> class Meta:
> model = User
> field = ("username", "email")
> app_label = "PyQuiz"
> 
> ```
> 
> class UserRegisterForm(UserCreationForm):
> 
> ```
> class Meta:
> model = User
> fields = ["name", "email", "password1", "password2"]
> app_label = "PyQuiz"
> 
> ```
> 
> class UserUpdateForm(forms.ModelForm):
> 
> ```
> class Meta:
> model = User
> fields = ["name", "email"]
> app_label = "PyQuiz"
> 
> ```
> 
> class profileUpdateForm(forms.ModelForm):
> 
> ```
> class Meta:
> model = Profile
> fields = ["address", "image"]
> app_label = "PyQuiz"
> 
> ```
> 
> class UserLoginForm(LoginForm):  
> email = forms.EmailField(),
> 
> ```
> class Meta:
> model = User
> feilds = ["email", "password"]
> app_label = "PyQuiz"
> 
> ```
> 
> class EmailAddress(LoginForm):
> 
> ```
> class Meta:
> app_label = "PyQuiz"
> 
> ```

**models.py**

> from django.db import models  
> from django.contrib.auth.models import AbstractBaseUser, BaseUserManager, PermissionsMixin # User  
> from django.utils import timezone
> 
> from django.db.models.signals import post\_save  
> from django.dispatch import receiver  
> from PIL import Image
> 
> # Create your models here.
> 
> class Address(models.Model):  
> name = models.CharField(max\_length=30)  
> address = models.CharField(max\_length=50)  
> city = models.CharField(max\_length=60, default=“”)  
> state = models.CharField(max\_length=30, default=“”)  
> postcode = models.CharField(max\_length=6, default=“”)  
> country = models.CharField(max\_length=50)
> 
> ```
> class Meta:
> verbose_name = "Address"
> verbose_name_plural = " Address"
> app_label = "PyQuiz"
>     
> def __str__ (self):
> return self.name
> 
> ```
> 
> class UserManager(BaseUserManager):
> 
> ```
> def _create_user(self, email, password, is_staff, is_superuser, **extra_fields):
> if not email:
> raise ValueError("Users must have an email address")
> now = timezone.now()
> email = self.normalize_email(email)
> user = self.model(
> email = email,
> is_staff = is_staff,
> is_active = True,
> is_superuser = is_superuser,
> last_login = now, 
> date_joined= now,
> **extra_fields
> )
> user.set_password(password)
> user.save(using=self._db)
> return user
> 
> def create_user(self, email, password, **extra_fields):
> return self._create_user(email, password, True, True, **extra_fields)
> 
> def create_superuser(self, email, password, **extra_fields):
> user = self._create_user(email, password, True, True, **extra_fields)
> user.save(using= self._db)
> return user
> 
> class Meta:
> app_label = "PyQuiz"
> 
> ```
> 
> class User(AbstractBaseUser, PermissionsMixin):  
> email = models.EmailField(max\_length=254, unique=True)  
> name = models.CharField(max\_length=254, null= True, blank= True)  
> user\_name = models.CharField(max\_length=254, null=True, blank=True)  
> is\_staff = models.BooleanField(default=False)  
> is\_superuser = models.BooleanField(default=False)  
> is\_active = models.BooleanField(default=True)  
> last\_login = models.DateTimeField(null=True, blank=True)  
> date\_joined = models.DateTimeField(auto\_now\_add=True)
> 
> ```
> USERNAME_FIELD = "email"
> EMAIL_FIELD = "email"
> REQUIRED_FIELDS = []
> 
> objects = UserManager()
> 
> def get_absolute_url(self):
> return "/users/%i/" % (self.pk)
> 
> ```
> 
> class Profile(models.Model):  
> user = models.OneToOneField(User, unique=True, on\_delete=models.CASCADE, default=None)  
> address = models.CharField(max\_length=254, null=True, blank=True)  
> image = models.ImageField(default=“default.jpg”, upload\_to=“profile\_pics”)
> 
> ```
> def __str__ (self):
> return f"{self.user.name} Profile"
> 
> def save(self, *args, **kwargs):
> super.save(*args, **kwargs)
> 
> ```
> 
> @receiver(post\_save, sender= User)  
> def create\_user\_profile(sender, instance, created, \*\*kwargs):  
> if created:  
> Profile.objects.create(user=instance)
> 
> @receiver(post\_save, sender=User)  
> def save\_user\_profile(sender, instance, \*\*kwards):  
> instance.profile.save()

**setting.py**

Application definition

> INSTALLED\_APPS = [  
> ‘PyQuiz.apps.PyquizConfig’,  
> ‘django.contrib.admin’,  
> ‘django.contrib.auth’,  
> ‘django.contrib.contenttypes’,  
> ‘django.contrib.sessions’,  
> ‘django.contrib.messages’,  
> ‘django.contrib.staticfiles’,  
> # ‘allauth.account’,  
> ]

Thanks  
Kiran

---

<div class="post-metadata">

**Author:** ![cliff688](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/cliff688/32/22816_2.png) [@cliff688](https://forum.djangoproject.com/u/cliff688)\
**Post date:** [September 11, 2024, 10:21am UTC](https://forum.djangoproject.com/t/model-class-allauth-account-models-emailaddress-doesnt-declare-an-explicit-app-label-and-isnt-in-an-application-in-installed-apps/34700/2 "2024-09-11T10:21:59Z")

</div>

Welcome @kirankthota79 !

I think the issue has to do with how the `'allauth.account'` app is commented out in INSTALLED\_APPS. Change it so it doesn’t begin with a #.

---

<div class="post-metadata">

**Author:** ![kirankthota79](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kirankthota79/32/23840_2.png) [@kirankthota79](https://forum.djangoproject.com/u/kirankthota79)\
**Post date:** [September 11, 2024, 12:00pm UTC](https://forum.djangoproject.com/t/model-class-allauth-account-models-emailaddress-doesnt-declare-an-explicit-app-label-and-isnt-in-an-application-in-installed-apps/34700/3 "2024-09-11T12:00:16Z")

</div>

Thanks mate, i have uncomment it (removed #)in Setting.py which fixed the issue
