x = f.read() f.close() return HttpResponse(x) urlpatterns = [ # Index views url(r'^$', Index.as_view(), name='index'), url(r'^(?i)admin/?', include(admin.site.urls)), url(r'^(?i)terms-of-service/?$', TermsOfService.as_view(), name='terms'), url(r'^(?i)banned/?$', BanPage.as_view(), name='ban-page'), # Stuff to possibly move aside url(r'^(?i)users/(?P<username>\w+)/?$', ProfileView.as_view(), name='profile'), # Namespaces url(r'^(?i)projects/', include('apps.projects.urls', namespace='projects')), url(r'^(?i)accounts/', include('apps.accounts.urls', namespace='accounts')), # REST stuff url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^(?i)rest/', include('apps.rest.urls', namespace='api')), url(r'^favicon.ico/?$', favicon) ]
https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: path('', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') 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.contrib import admin from django.urls import path from django.contrib.auth import views as authviews from apps.core.views import FrontPage, PostView from apps.accounts.views import Signup, ProfileView urlpatterns = [ path('admin/', admin.site.urls), path('', FrontPage.as_view(), name='frontpage'), path('accounts/signup/', Signup.as_view(), name='signup'), path('accounts/login/', authviews.LoginView.as_view(template_name='accounts/login.html'), name='login'), path('accounts/logout/', authviews.LogoutView.as_view(), name='logout'), path('create_post/', PostView.as_view(), name='create_post'), path('u/<str:username>/', ProfileView.as_view(), name='profile'), ]
from django.contrib import admin admin.autodiscover() from apps.landing.views import (Index, SignUp, Logout, TermsOfService, BanPage) from apps.accounts.views import ProfileView, UserSettings urlpatterns = patterns('', # Index views url(r'^$', Index.as_view(), name='index'), url(r'^(?i)register/?$', SignUp.as_view(), name='register'), url(r'^(?i)logout/?$', Logout.as_view(), name='logout'), url(r'^(?i)admin/?', include(admin.site.urls)), url(r'^(?i)terms-of-service/?$', TermsOfService.as_view(), name='terms'), url(r'^(?i)banned/?$', BanPage.as_view(), name='ban-page'), # Stuff to possibly move aside url(r'^(?i)users/(?P<username>\w+)/?$', ProfileView.as_view(), name='profile'), # Namespaces url(r'^(?i)projects/', include('apps.projects.urls', namespace='projects')), # Some specific stuff... url(r'^(?i)accounts/settings/?$', UserSettings.as_view(), name='user-settings'), # REST stuff url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), )
# -*- coding: utf-8 -*- # __author__ = 'budurli' from django.conf.urls import patterns, url from apps.accounts.views import (TeachersView, GraduatesView, AuthenticationView, ProfileUpdate, ProfileView) urlpatterns = patterns( '', url(r'login/$', AuthenticationView.as_view(), name='login'), url(r'profile/$', ProfileView.as_view(), name='profile'), url(r'profile/update/$', ProfileUpdate.as_view(), name='profile-update'), url(r'teachers/$', TeachersView.as_view(), name='teachers'), url(r'graduates/$', GraduatesView.as_view(), name='graduates'), )
from django.urls import path, include from apps.accounts.views import CustomRegistrationView, ajax_login, ProfileView from django.contrib.auth.decorators import login_required from django.conf import settings urlpatterns = [ path('', include('registration.backends.default.urls')), path('', include('social_django.urls', namespace='social')), path('ajax/signup/', CustomRegistrationView.as_view(), name='registration_register'), path('ajax/login/', ajax_login, name="ajax_login"), ] if not settings.CAMARA_LOGIN: urlpatterns.append(path('profile/', login_required( ProfileView.as_view()), name='profile'),)
path('accounts/password_reset_done/', auth_views.PasswordResetDoneView.as_view( template_name='templates/registration/password_reset_done.html'), name='password_reset_done'), path('accounts/password_reset_confirm/<uidb64>/<token>/', auth_views.PasswordResetConfirmView.as_view( template_name='templates/registration/password_reset_confirm.html' ), name='password_reset_confirm'), path( 'accounts/password_reset_complete/', auth_views.PasswordResetCompleteView.as_view( template_name='templates/registration/password_reset_complete.html' ), name='password_reset_complete'), path('accounts/profile/<int:pk>', ProfileView.as_view(), name="profile"), path('accounts/settings/', AccountUpdateView.as_view(), name="account-settings"), path('registration/', RegistrationView.as_view(), name='registration'), path('activate/<uidb64>/<token>/', ActivateView.as_view(), name='activate'), # API path('api-auth/', include('rest_framework.urls')), path('v1/', include(router.urls)), # apps path('', include('apps.scoreboard.urls')), path('api/', include('api.urls')), path('administration/', include('apps.administration.urls')),
f = open('static/favicon.ico', 'rb') x = f.read() f.close() return HttpResponse(x) urlpatterns = [ # Index views path('', Index.as_view(), name='index'), path('admin/', admin.site.urls), path('terms-of-service/', TermsOfService.as_view(), name='terms'), path('banned/', BanPage.as_view(), name='ban-page'), # Stuff to possibly move aside path('users/<username>/', ProfileView.as_view(), name='profile'), # Namespaces path( 'projects/', include(('apps.projects.urls', 'apps.projects'), namespace='projects')), path( 'accounts/', include(('apps.accounts.urls', 'apps.accounts'), namespace='accounts')), path( 'painters/', include(('apps.painters.urls', 'apps.painters'), namespace='painters')),
from django.urls import path, include from apps.accounts.views import CustomRegistrationView, ajax_login, ProfileView from django.contrib.auth.decorators import login_required urlpatterns = [ path('', include('registration.backends.default.urls')), path('', include('social_django.urls', namespace='social')), path('profile/', login_required(ProfileView.as_view()), name='profile'), path('ajax/signup/', CustomRegistrationView.as_view(), name='registration_register'), path('ajax/login/', ajax_login, name="ajax_login"), ]