django-allauth定制模板(转载)
假設工程結構如下:
$ pwd
/home/appleyuchi/桌面/Ebusiness/django-allauth的調研-完成/django-allauth教程(4)-完成
$ tree
.
├── oauth(工程文件夾名字)
│???├── db.sqlite3
│???├── manage.py
│???├── myaccount
│???│???├── admin.py
│???│???├── apps.py
│???│???├── __init__.py
│???│???├── migrations
│???│???│???└── __init__.py
│???│???├── models.py
│???│???├── tests.py
│???│???└── views.py
│???├── oauth(主文件夾名字)
│???│???├── __init__.py
│???│???├── __pycache__
│???│???├── settings.py
│???│???├── urls.py
│???│???└── wsgi.py
│???└── templates
│??? ? ?├── account
│??? ? ?│???├── account_inactive.html
│??? ? ?│???├── base.html
│??? ? ?│???├── email
│??? ? ?│???│???├── email_confirmation_message.txt
│??? ? ?│???│???├── email_confirmation_signup_message.txt
│??? ? ?│???│???├── email_confirmation_signup_subject.txt
│??? ? ?│???│???├── email_confirmation_subject.txt
│??? ? ?│???│???├── password_reset_key_message.txt
│??? ? ?│???│???└── password_reset_key_subject.txt
│??? ? ?│???├── email_confirm.html
│??? ? ?│???├── email.html
│??? ? ?│???├── login.html
│??? ? ?│???├── logout.html
│??? ? ?│???├── messages
│??? ? ?│???│???├── cannot_delete_primary_email.txt
│??? ? ?│???│???├── email_confirmation_sent.txt
│??? ? ?│???│???├── email_confirmed.txt
│??? ? ?│???│???├── email_deleted.txt
│??? ? ?│???│???├── logged_in.txt
│??? ? ?│???│???├── logged_out.txt
│??? ? ?│???│???├── password_changed.txt
│??? ? ?│???│???├── password_set.txt
│??? ? ?│???│???├── primary_email_set.txt
│??? ? ?│???│???└── unverified_primary_email.txt
│??? ? ?│???├── password_change.html
│??? ? ?│???├── password_reset_done.html
│??? ? ?│???├── password_reset_from_key_done.html
│??? ? ?│???├── password_reset_from_key.html
│??? ? ?│???├── password_reset.html
│??? ? ?│???├── password_set.html
│??? ? ?│???├── signup_closed.html
│??? ? ?│???├── signup.html
│??? ? ?│???├── snippets
│??? ? ?│???│???├── already_logged_in.html
│??? ? ?│???│???└── bs4_form.html
│??? ? ?│???├── verification_sent.html
│??? ? ?│???└── verified_email_required.html
│??? ? ?├── base.html
│??? ? ?├── base_origin.html
│??? ? ?├── openid
│??? ? ?│???├── base.html
│??? ? ?│???└── login.html
│??? ? ?├── socialaccount
│??? ? ?│???├── authentication_error.html
│??? ? ?│???├── base.html
│??? ? ?│???├── connections.html
│??? ? ?│???├── login_cancelled.html
│??? ? ?│???├── messages
│??? ? ?│???│???├── account_connected_other.txt
│??? ? ?│???│???├── account_connected.txt
│??? ? ?│???│???├── account_connected_updated.txt
│??? ? ?│???│???└── account_disconnected.txt
│??? ? ?│???├── signup.html
│??? ? ?│???└── snippets
│??? ? ?│??? ? ?├── login_extra.html
│??? ? ?│??? ? ?└── provider_list.html
│??? ? ?└── tests
│??? ? ? ? ?└── test_403_csrf.html
└── 實驗說明.txt
?
那么首先需要在配置文件中修改templates的路徑
settings.py 中修改DIRS:
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',
? ? ? ? ? ? ],
? ? ? ? },
? ? },
]
?
從[1]下載templates文件夾復制到BASE_DIR:
/home/appleyuchi/桌面/Ebusiness/django-allauth的調研-完成/django-allauth教程(4)-完成/oauth/
下面即可
?
Reference:
[1]https://github.com/pennersr/django-allauth/tree/master/allauth
[2]https://blog.csdn.net/weixin_42134789/article/details/80690040
總結
以上是生活随笔為你收集整理的django-allauth定制模板(转载)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阿里云物流+Flask整合
- 下一篇: LookupError: No inst