This commit is contained in:
Dmitriy Andreev
2021-02-11 20:18:32 +03:00
22 changed files with 423 additions and 13 deletions

View File

@@ -15,7 +15,6 @@ from pathlib import Path
# 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.1/howto/deployment/checklist/
@@ -27,7 +26,6 @@ DEBUG = True
ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
@@ -37,6 +35,7 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_registration',
'main',
]
@@ -72,7 +71,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'access_controller.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.1/ref/settings/#databases
@@ -83,7 +81,6 @@ DATABASES = {
}
}
# Password validation
# https://docs.djangoproject.com/en/3.1/ref/settings/#auth-password-validators
@@ -102,7 +99,6 @@ AUTH_PASSWORD_VALIDATORS = [
},
]
# Internationalization
# https://docs.djangoproject.com/en/3.1/topics/i18n/
@@ -116,7 +112,6 @@ USE_L10N = True
USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/3.1/howto/static-files/
@@ -127,3 +122,7 @@ STATICFILES_DIRS = [
]
MEDIA_ROOT = BASE_DIR / 'media'
MEDIA_URL = '/media/'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'

View File

@@ -13,12 +13,23 @@ Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
from main.views import main_page
from django.urls import path, include
from django.contrib.auth.views import LoginView
from django.urls import path, include
from access_controller import settings
from main.views import *
urlpatterns = [
path('admin/', admin.site.urls),
path('admin/', admin.site.urls, name='admin'),
path('', main_page),
path('register/', CustomRegistrationView.as_view(), name='registration'),
# path('', include('django_registration.backends.one_step.urls')),
path('profile/', profile_page, name='profile'),
path('accounts/login/', LoginView.as_view(extra_context={})), # TODO add extra context
path('accounts/', include('django.contrib.auth.urls'))
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)