Django allauth signup view not working coorecly

536 views Asked by At

I have a problem signup allauth. I am tryin add new account but when try it i get this error. Other functions(login, logout and other password works) are working.
Other view is working but singup not working, when i want to add new user, i got this problem.

Internal Server Error: /accounts/signup/
Traceback (most recent call last):
File "/root/PycharmProjects/essahmi/venv/lib/python3.8/site- 
packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/root/PycharmProjects/essahmi/venv/lib/python3.8/site- 
packages/django/core/handlers/base.py", line 179, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/root/PycharmProjects/essahmi/venv/lib/python3.8/site- 
packages/django/views/generic/base.py", line 70, in view
.
.
.
return super(CloseableSignupMixin, self).dispatch(request,
File "/root/PycharmProjects/essahmi/venv/lib/python3.8/site- 
packages/django/views/generic/base.py", line 98, in dispatch
return handler(request, *args, **kwargs)
File "/root/PycharmProjects/essahmi/venv/lib/python3.8/site-packport_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 973, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'some'

I have not written any code yet baceuse i am have just started project an firlly i want to integrate to allauth in project my directories is:

enter code here
essahmi
├── __pycache__
└── settings
    └── __pycache__
home
├── migrations
│   └── __pycache__
└── __pycache__
templates
├── account
├── allauth
│   └── account
│       ├── email
│       ├── messages
│       └── snippets
├── base
│   └── companent
└── home
static/
├── css
├── img
└── js

settings.py

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites',
    #my app
    'home',

    # third party apps

    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'crispy_forms',
]

MIDDLEWARE = [
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ROOT_URLCONF = 'essahmi.urls'

TEMPLATES = [
    {
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR,'templates'),os.path.join(BASE_DIR,'templates','allauth'),],
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
            # For allouth
            'django.template.context_processors.request',
        ],
    },
    },
]
WSGI_APPLICATION = 'essahmi.wsgi.application'





# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
    {
    'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
    },
    {
    'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
    },
    {
    'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
    },
    {
    'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
    },
]


# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/

LANGUAGE_CODE = 'tr'

TIME_ZONE = 'Europe/Istanbul'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/

STATIC_URL = 'static/'

MEDIA_URL = 'media/'
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')



# allauth settings

AUTHENTICATION_BACKENDS = [
    'django.contrib.auth.backends.ModelBackend',
    'allauth.account.auth_backends.AuthenticationBackend',  
]

SITE_ID = 1
LOGIN_REDIRECT_URL = "/"
ACCOUNT_USERNAME_VALIDATORS = 'some.module.validators.custom_username_validators'
ACCOUNT_EMAIL_REQUIRED = True
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'

ACCOUNT_FORMS = {
    'login': 'allauth.account.forms.LoginForm',
    'signup': 'allauth.account.forms.SignupForm',
    'add_email': 'allauth.account.forms.AddEmailForm',
    'change_password': 'allauth.account.forms.ChangePasswordForm',
    'set_password': 'allauth.account.forms.SetPasswordForm',
    'reset_password': 'allauth.account.forms.ResetPasswordForm',
    'reset_password_from_key': 'allauth.account.forms.ResetPasswordKeyForm',
    'disconnect': 'allauth.socialaccount.forms.DisconnectForm',
}

# crispy form settings
CRISPY_TEMPLATE_PACK = 'bootstrap4'

from essahmi.settings.base import *


DEBUG = True


# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases

DATABASES = {
    'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': BASE_DIR / 'db.sqlite3',
    }
}


STATICFILES_DIRS = [
    os.path.join(BASE_DIR, "static"),
]
1

There are 1 answers

0
Ralf On BEST ANSWER

The error stems from your settings line:

ACCOUNT_USERNAME_VALIDATORS = 'some.module.validators.custom_username_validators'

The is no module some in your project structure, so it is not found.