added messages to jinja context, added urls for new apps, updated core settings
This commit is contained in:
parent
10ccab21eb
commit
cba4094e2b
|
@ -3,8 +3,9 @@
|
|||
Custom Jinja2 environment.
|
||||
"""
|
||||
import jinja2
|
||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||
from django.urls import reverse
|
||||
from django.contrib import messages
|
||||
from django.contrib.staticfiles.storage import staticfiles_storage
|
||||
|
||||
def environment(**options):
|
||||
"""
|
||||
|
@ -12,11 +13,13 @@ def environment(**options):
|
|||
"""
|
||||
env = jinja2.Environment(**options)
|
||||
env.globals.update({
|
||||
'static': staticfiles_storage.url,
|
||||
'url': reverse,
|
||||
'undefined': jinja2.StrictUndefined,
|
||||
'autoescape': True,
|
||||
'trim_blocks': True,
|
||||
'lstrip_blocks': True,
|
||||
|
||||
'url': reverse,
|
||||
'static': staticfiles_storage.url,
|
||||
'get_messages': messages.get_messages,
|
||||
})
|
||||
return env
|
||||
|
|
|
@ -31,9 +31,12 @@ INSTALLED_APPS = [
|
|||
'django.contrib.sessions',
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'quest.apps.QuestConfig',
|
||||
'users.apps.UsersConfig',
|
||||
'homepage.apps.HomepageConfig',
|
||||
'create_quest.apps.CreateQuestConfig',
|
||||
'quest.apps.QuestConfig',
|
||||
'login.apps.LoginConfig',
|
||||
'signup.apps.SignupConfig',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
|
@ -58,6 +61,19 @@ TEMPLATES = [
|
|||
'auto_reload': DEBUG,
|
||||
},
|
||||
},
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'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 = 'titivillus.wsgi.application'
|
||||
|
@ -87,6 +103,9 @@ AUTH_PASSWORD_VALIDATORS = [
|
|||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
|
||||
'OPTIONS': {
|
||||
'min_length': 8,
|
||||
}
|
||||
},
|
||||
{
|
||||
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
|
||||
|
@ -119,3 +138,12 @@ STATIC_ROOT = '/usr/local/www/html/static/'
|
|||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, 'static'),
|
||||
]
|
||||
|
||||
AUTH_USER_MODEL = 'users.User'
|
||||
|
||||
PASSWORD_HASHERS = [
|
||||
'django.contrib.auth.hashers.Argon2PasswordHasher',
|
||||
'django.contrib.auth.hashers.PBKDF2PasswordHasher',
|
||||
'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
|
||||
'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
|
||||
]
|
||||
|
|
|
@ -11,4 +11,7 @@ urlpatterns = [
|
|||
path('quest/', include('quest.urls')),
|
||||
path('create_quest/', include('create_quest.urls')),
|
||||
path('set_session/', include('set_session.urls')),
|
||||
path('signup/', include('signup.urls')),
|
||||
path('login/', include('login.urls')),
|
||||
path('logout/', include('logout.urls')),
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user