Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 非常慢的Oauth身份验证django allauth_Python_Django_Django Allauth - Fatal编程技术网

Python 非常慢的Oauth身份验证django allauth

Python 非常慢的Oauth身份验证django allauth,python,django,django-allauth,Python,Django,Django Allauth,当我尝试注册时: 保留电子邮件验证=“必需” 通过Github加载回调url大约需要3-10分钟 通过电子邮件/密码注册,在“注册”按钮之后加载url需要3-10分钟 保留电子邮件验证=“无” 通过Github加载回调url大约需要3-10分钟 通过电子邮件/密码注册正在顺利进行 以下是代码文件: settings.py: Django settings for config project. Generated by 'django-admin startproject' using

当我尝试注册时: 保留电子邮件验证=“必需”

  • 通过Github加载回调url大约需要3-10分钟
  • 通过电子邮件/密码注册,在“注册”按钮之后加载url需要3-10分钟
保留电子邮件验证=“无”

  • 通过Github加载回调url大约需要3-10分钟
  • 通过电子邮件/密码注册正在顺利进行
以下是代码文件:

settings.py:

Django settings for config project.

Generated by 'django-admin startproject' using Django 3.2.

For more information on this file, see
https://docs.djangoproject.com/en/3.2/topics/settings/

For the full list of settings and their values, see
https://docs.djangoproject.com/en/3.2/ref/settings/
"""

from pathlib import Path
import os

# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent


# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-xc-592)no)((2&6grj56rfw$um58(cd(+0zvs2f=ar0wq6&@0='

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

ALLOWED_HOSTS = []


# Application definition

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django.contrib.sites', # new
    'userlogin',

    'allauth', # new
    'allauth.account', # new
    'allauth.socialaccount', # new
    'allauth.socialaccount.providers.github', # new
    'allauth.socialaccount.providers.shopify',
]

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 = 'config.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',
            ],
        },
    },
]

WSGI_APPLICATION = 'config.wsgi.application'


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

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


# Password validation
# https://docs.djangoproject.com/en/3.2/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.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'UTC'

USE_I18N = True

USE_L10N = True

USE_TZ = True


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

STATIC_URL = '/static/'

# Default primary key field type
# https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

AUTHENTICATION_BACKENDS = (
    "django.contrib.auth.backends.ModelBackend",
    "allauth.account.auth_backends.AuthenticationBackend",
)

SITE_ID = 1

ACCOUNT_EMAIL_VERIFICATION = 'none'

LOGIN_REDIRECT_URL = 'home'
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'none'
ACCOUNT_USERNAME_REQUIRED = False

#mailgun creds
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.mailgun.org'
EMAIL_HOST_USER = 'postmaster1@alerts.xxxxxx.io'
EMAIL_HOST_PASSWORD = 'xxxxxxx'
EMAIL_PORT = 587
ACCOUNT_CONFIRM_EMAIL_ON_GET = True
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True

#Modifying shopify access scope

SOCIALACCOUNT_PROVIDERS = {
    'shopify': {
        'SCOPE': ['read_products','write_products','read_orders','write_orders','write_order_edits']
    }
}
项目树:

URL.py:

from django.contrib import admin
from django.urls import path, include
from userlogin import views

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include('allauth.urls')),
    path('', views.home,name='home'),
    path('orders/', views.orders,name='orders'),
]
控制台日志:

[16/May/2021 01:05:07] "GET /accounts/github/login/?process=login&next=%2F HTTP/1.1" 302 0
[16/May/2021 01:13:23] "GET /accounts/github/login/callback/?code=e4f316f33ab6aa66b058&state=MjOwL8N4N2bK HTTP/1.1" 302 0
[16/May/2021 01:13:23] "GET /accounts/confirm-email/ HTTP/1.1" 200 882

[16/May/2021 00:50:20] "GET /accounts/signup/?next=%2F HTTP/1.1" 200 1690
[16/May/2021 00:54:31] "POST /accounts/signup/ HTTP/1.1" 302 0
[16/May/2021 00:54:31] "GET /accounts/confirm-email/ HTTP/1.1" 200 882