It is an output of what was learned by a web development beginner. I'm studying web development with Django ...
What is Wagtail in the first place is a content management system (CMS) built on ** Django **. Roughly speaking, you can easily create management pages such as blogs.
Immediately, we will go through the steps from project creation to login page creation.
We will proceed on the assumption that Pipenv and Virtualenv will be used.
pip install wagtail
wagtail start mysite
cd mysite
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver
You should now be able to create your Wagtail project and access the initial page below.
First, install django-allauth and enable Allauth in base.py
under the mysite / settings
directory.
pip install django-allauth
base.py
'django.template.context_processors.request', #to add
TEMPLATES = [
{
# ...,
'OPTIONS': {
'context_processors': [
# ...
'django.template.context_processors.request', #If not, add
# ...
],
},
},
]
INSTALLED_APPS = (
# ... other apps
#If not, add the following
'django.contrib.auth',
'django.contrib.messages',
'django.contrib.sites',
'allauth',
'allauth.account',
'allauth.socialaccount',
# ...
)
AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend',
'allauth.account.auth_backends.AuthenticationBackend',
) #to add
#Add the following
LOGIN_URL = '/login/'
LOGIN_REDIRECT_URL = '/'
ACCOUNT_AUTHENTICATION_METHOD = "username_email"
ACCOUNT_CONFIRM_EMAIL_ON_GET = True
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = "mandatory"
ACCOUNT_LOGIN_ON_EMAIL_CONFIRMATION = True
ACCOUNT_LOGOUT_ON_GET = True
ACCOUNT_LOGIN_ON_PASSWORD_RESET = True
ACCOUNT_LOGOUT_REDIRECT_URL = '/login/'
ACCOUNT_PRESERVE_USERNAME_CASING = False
ACCOUNT_SESSION_REMEMBER = True
ACCOUNT_SIGNUP_PASSWORD_ENTER_TWICE = False
ACCOUNT_USERNAME_BLACKLIST = ["admin", "god"]
ACCOUNT_USERNAME_MIN_LENGTH = 2
Next, set the url pattern for the login page.
urls.py
urlpatterns = [
# .. Existing urls
#to add
url(r'', include('allauth.urls')),
url(r'', include(wagtail_urls)),
]
Finally, migrate and access the login page from http: // localhost: 8000 / login / and you're done.
python manage.py migrate
I checked the flow of creating a login page using django-allauth
. The login page itself can be introduced immediately by just playing with base.py
and ʻurls.py`, so you can proceed with efficient application development!
LEARN WAGTAIL -HOW TO INSTALL WAGTAIL WITH DOCKER https://learnwagtail.com/tutorials/how-install-wagtail-docker/
-ADDING USER REGISTRATION/LOGIN TO YOUR WAGTAIL WEBSITE https://learnwagtail.com/tutorials/adding-user-authentication-registration-and-login-your-wagtail-website/
Recommended Posts