Anonymous
Django Allauth — ModuleNotFoundError: нет модуля с именем «allauth.account.middleware», даже если django-allauth установ
Сообщение
Anonymous » 29 ноя 2024, 08:46
"ModuleNotFoundError: Нет модуля с именем 'allauth.account.middleware'"
Я продолжаю получать эту ошибку в своем проекте django, даже когда django-allauth полностью установлен и настроен???
Я пробовал даже переустановить и изменить свой Python на Python3, но ничего не изменилось, не могу понять, почему все остальные импорты работают, кроме MIDDLEWARE...
Помогите, пожалуйста?
settings.py:
Код: Выделить всё
"""
Django settings for youtube2blog2 project.
Generated by 'django-admin startproject' using Django 4.2.4.
For more information on this file, see
For the full list of settings and their values, see
"""
from pathlib import Path
import django
import os
import logging
import pyfiglet
import allauth
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
# Quick-start development settings - unsuitable for production
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'omegalul'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
ALLOWED_HOSTS = []
# CUSTOM CODE
# os.environ['FFMPEG_PATH'] = '/third-party/ffmpeg.exe'
# os.environ['FFPROBE_PATH'] = '/third-party/ffplay.exe'
OFFLINE_VERSION = False
def offline_version_setup(databases):
if (OFFLINE_VERSION):
# WRITE CODE TO REPLACE DATABASES DICT DATA FOR OFFLINE SETUP HERE
return True
return
banner_ascii_art = pyfiglet.figlet_format("CHRIST IS KING ENTERPRISES")
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
print("\n - CURRENT DJANGO VERSION: " + str(django.get_version()))
print("\n - settings.py: Current logger level is " + str(logger.getEffectiveLevel()))
logger.debug('settings.py: Logger is working.\n\n')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'
AUTHENTICATION_BACKENDS = [
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by email
'allauth.account.auth_backends.AuthenticationBackend',
]
'''
NEEDED SETUP FOR SOCIAL AUTH
REQUIRES DEVELOPER CREDENTIALS
ON PAUSE UNTIL MVP IS DONE
# Provider specific settings
SOCIALACCOUNT_PROVIDERS = {
'google': {
# For each OAuth based provider, either add a ``SocialApp``
# (``socialaccount`` app) containing the required client
# credentials, or list them here:
'APP': {
'client_id': '123',
'secret': '456',
'key': ''
}
}
'apple': {
}
'discord' {
}
}
'''
LOGIN_REDIRECT_URL = 'dashboard'
#
# Application definition
INSTALLED_APPS = [
# My Apps
'yt2b2',
'home',
'dashboard',
# Django Apps
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Downloaded Apps
'rest_framework',
'embed_video',
'allauth',
'allauth.account',
'allauth.socialaccount',
#'allauth.socialaccount.providers.google',
#'allauth.socialaccount.providers.apple',
#'allauth.socialaccount.providers.discord',
]
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',
# Downloaded Middleware
'allauth.account.middleware.AccountMiddleware',
]
ROOT_URLCONF = 'youtube2blog2.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'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',
],
},
},
]
WSGI_APPLICATION = 'youtube2blog2.wsgi.application'
# Database
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3', #
Подробнее здесь: [url]https://stackoverflow.com/questions/77012106/django-allauth-modulenotfounderror-no-module-named-allauth-account-middlewar[/url]
1732859181
Anonymous
"ModuleNotFoundError: Нет модуля с именем 'allauth.account.middleware'" Я продолжаю получать эту ошибку в своем проекте django, даже когда django-allauth полностью установлен и настроен??? Я пробовал даже переустановить и изменить свой Python на Python3, но ничего не изменилось, не могу понять, почему все остальные импорты работают, кроме MIDDLEWARE... Помогите, пожалуйста? settings.py: [code]""" Django settings for youtube2blog2 project. Generated by 'django-admin startproject' using Django 4.2.4. For more information on this file, see For the full list of settings and their values, see """ from pathlib import Path import django import os import logging import pyfiglet import allauth # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'omegalul' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # CUSTOM CODE # os.environ['FFMPEG_PATH'] = '/third-party/ffmpeg.exe' # os.environ['FFPROBE_PATH'] = '/third-party/ffplay.exe' OFFLINE_VERSION = False def offline_version_setup(databases): if (OFFLINE_VERSION): # WRITE CODE TO REPLACE DATABASES DICT DATA FOR OFFLINE SETUP HERE return True return banner_ascii_art = pyfiglet.figlet_format("CHRIST IS KING ENTERPRISES") logger = logging.getLogger() logger.setLevel(logging.DEBUG) print("\n - CURRENT DJANGO VERSION: " + str(django.get_version())) print("\n - settings.py: Current logger level is " + str(logger.getEffectiveLevel())) logger.debug('settings.py: Logger is working.\n\n') MEDIA_ROOT = os.path.join(BASE_DIR, 'media') MEDIA_URL = '/media/' AUTHENTICATION_BACKENDS = [ # Needed to login by username in Django admin, regardless of `allauth` 'django.contrib.auth.backends.ModelBackend', # `allauth` specific authentication methods, such as login by email 'allauth.account.auth_backends.AuthenticationBackend', ] ''' NEEDED SETUP FOR SOCIAL AUTH REQUIRES DEVELOPER CREDENTIALS ON PAUSE UNTIL MVP IS DONE # Provider specific settings SOCIALACCOUNT_PROVIDERS = { 'google': { # For each OAuth based provider, either add a ``SocialApp`` # (``socialaccount`` app) containing the required client # credentials, or list them here: 'APP': { 'client_id': '123', 'secret': '456', 'key': '' } } 'apple': { } 'discord' { } } ''' LOGIN_REDIRECT_URL = 'dashboard' # # Application definition INSTALLED_APPS = [ # My Apps 'yt2b2', 'home', 'dashboard', # Django Apps 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', # Downloaded Apps 'rest_framework', 'embed_video', 'allauth', 'allauth.account', 'allauth.socialaccount', #'allauth.socialaccount.providers.google', #'allauth.socialaccount.providers.apple', #'allauth.socialaccount.providers.discord', ] 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', # Downloaded Middleware 'allauth.account.middleware.AccountMiddleware', ] ROOT_URLCONF = 'youtube2blog2.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], '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', ], }, }, ] WSGI_APPLICATION = 'youtube2blog2.wsgi.application' # Database DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', # Подробнее здесь: [url]https://stackoverflow.com/questions/77012106/django-allauth-modulenotfounderror-no-module-named-allauth-account-middlewar[/url]