The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.2/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, re_path from resume.views import MainMenuView, ResumeListView, SignupView, MyLoginView, NewResumeView, HomeView from vacancy.views import VacancyListView, NewVacancyView urlpatterns = [ path('admin/', admin.site.urls), path('', MainMenuView.as_view()), re_path('vacancies/?', VacancyListView.as_view()), re_path('resumes/?', ResumeListView.as_view()), re_path('login/?', MyLoginView.as_view()), re_path('signup/?', SignupView.as_view()), re_path('vacancy/new/?', NewVacancyView.as_view()), re_path('resume/new/?', NewResumeView.as_view()), re_path('home/?', HomeView.as_view()), ]
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.views.generic.base import TemplateView, RedirectView from common.views import CreateUserView, MyLoginView, ProfileView from resume.views import ResumeListView, ResumeView from vacancy.views import VacancyListView, VacancyView urlpatterns = [ path("admin/", admin.site.urls), path("home", ProfileView.as_view()), path("resume/new", ResumeView.as_view()), path("vacancy/new", VacancyView.as_view()), path("resumes", ResumeListView.as_view()), path("vacancies", VacancyListView.as_view()), path("", TemplateView.as_view(template_name="common/menu.html")), path("login", MyLoginView.as_view()), path("signup", CreateUserView.as_view()), path('login/', RedirectView.as_view(url='/login')), path('signup/', RedirectView.as_view(url='/signup')) ]
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 .views import * from django.contrib.auth.views import LogoutView from vacancy.views import VacancyListView, NewVacancyView from resume.views import ResumeListView, NewResumeView urlpatterns = [ path('admin/', admin.site.urls), path('', MenuView.as_view()), path('vacancies', VacancyListView.as_view()), path('resumes', ResumeListView.as_view()), path('signup', SignupView.as_view()), path('login', MyLoginView.as_view()), path('logout', LogoutView.as_view()), path('home', HomeView.as_view()), path('resume/new', NewResumeView.as_view()), path('vacancy/new', NewVacancyView.as_view()) ]
from django.contrib import admin from django.urls import path from .views import MainView, SignupView, MyLoginView from resume.views import ResumeListView, CreateResume from vacancy.views import VacancyListView, CreateVacancy from django.contrib.auth import views as auth_views urlpatterns = [ path('vacancies', VacancyListView.as_view(), name="vacancy_list"), path('resumes', ResumeListView.as_view(), name="resume_list"), path('', MainView.as_view(), name="main"), path('admin/', admin.site.urls), path('home', MainView.as_view(), name="main"), path('signup', SignupView.as_view(), name='signup'), path('login', MyLoginView.as_view(), name='login'), path('logout', auth_views.LogoutView.as_view(), name='logout'), path('resume/new', CreateResume.as_view(), name='new_resume'), path('vacancy/new', CreateVacancy.as_view(), name='new_vacancy'), path('createResume', CreateResume.as_view()), path('createVacancy', CreateVacancy.as_view()), ]