Fix urls, update menu, codestyle improvements, add views in documentation

This commit is contained in:
Andrew Smirnov
2021-02-11 20:58:07 +03:00
parent ef36e8de40
commit 8c9b5a9cfa
5 changed files with 36 additions and 34 deletions

View File

@@ -116,13 +116,14 @@ USE_TZ = True
# https://docs.djangoproject.com/en/3.1/howto/static-files/
STATIC_URL = '/static/'
STATIC_ROOT = os.path.join(BASE_DIR, 'static')
STATIC_ROOT = os.path.join(BASE_DIR, 'staticroot')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, 'staticfiles'),
os.path.join(BASE_DIR, 'static'),
]
MEDIA_ROOT = BASE_DIR / 'media'
MEDIA_URL = '/media/'
LOGIN_REDIRECT_URL = '/'
LOGOUT_REDIRECT_URL = '/'

View File

@@ -15,21 +15,22 @@ Including another URLconf
"""
from django.conf.urls.static import static
from django.contrib import admin
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 *
from access_controller.settings import DEBUG
from main.views import main_page, profile_page, CustomRegistrationView
urlpatterns = [
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'))
path('', main_page, name='index'),
path('accounts/profile/', profile_page, name='profile'),
path('accounts/register/', CustomRegistrationView.as_view(), name='registration'),
path('accounts/login/', LoginView.as_view(extra_context={}), name='login'), # TODO add extra context
path('accounts/', include('django.contrib.auth.urls')),
path('accounts/', include('django_registration.backends.one_step.urls')),
]
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
if DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)