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.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include from app.views import index, blog, post, search, post_delete, post_update, post_create, PostDeleteView urlpatterns = [ path('admin/', admin.site.urls), path('', index, name='index'), path('blog/', blog, name='post-list'), path('search/', search, name='search'), path('post/<pk>/', post, name='post-detail'), path('create/', post_create, name='post-create'), path('post/<pk>/update/', post_update, name='post-update'), #path('post/<id>/delete/', post_delete, name='post-delete'), path('post/<pk>/delete/', PostDeleteView.as_view(), name='post-delete'), path('tinymce/', include('tinymce.urls')), path('accounts/', include('allauth.urls')), ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url, include from django.contrib import admin from django.conf import settings from django.conf.urls.static import static from app.views import (IndexView, UserCreateView, ProfileView, PostCreateView, PostDetailCommentCreateView, PostUpdateView, PostDeleteView, CommentUpdateView) urlpatterns = [ url(r'^admin/', admin.site.urls), url('^', include('django.contrib.auth.urls')), url(r'^create_user/$', UserCreateView.as_view(), name="user_create_view"), url(r'^$', IndexView.as_view(), name="index_view"), url(r'^accounts/profile/$', ProfileView.as_view(), name="profile_view"), url(r'^post/create/$', PostCreateView.as_view(), name="post_create_view"), url(r'^post/(?P<pk>\d+)/$', PostDetailCommentCreateView.as_view(), name="post_detail_comment_create_view"), url(r'^post/(?P<pk>\d+)/update/$', PostUpdateView.as_view(), name="post_update_view"), url(r'^post/(?P<pk>\d+)/delete/$', PostDeleteView.as_view(), name="post_delete_view"), url(r'^comment/(?P<pk>\d+)/update/$', CommentUpdateView.as_view(), name="comment_update_view") ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
LoginView, LogoutView, ) urlpatterns = [ path('', index, name='post_list'), path('', PostListView.as_view(), name='post_list'), path('register/', RegisterView.as_view(), name='register'), path('login/', LoginView.as_view(), name='login'), path('logout/', LogoutView.as_view(), name='logout'), path('post/<int:pk>', post_detail, name='post_detail'), path('post/create', PostCreateView.as_view(), name='post_create'), path('post/<int:pk>/edit', post_edit, name='post_edit'), path('post/<int:pk>/edit', PostEditView.as_view(), name='post_edit'), path('post/<int:pk>/delete', post_delete, name='post_delete'), path('post/<int:pk>/delete', PostDeleteView.as_view(), name='post_delete'), path('post/<int:pk>/comment/create', comment_create, name='comment_create'), path('post/<int:pk>/comment/create', CommentCreateView.as_view(), name='comment_create'), path('post/<int:pk>/comment/<int:pk_comment>/edit', CommentEditView.as_view(), name='comment_edit'), path('post/<int:pk>/comment/<int:pk_comment>/delete', CommentDeleteView.as_view(), name='comment_delete'), path('userprofile/<int:pk>', UserProfileView.as_view(), name='user_profile'), path('userprofile/<int:pk>/relations',
urlpatterns = [ path("", views.index, name='index'), path(r"register/", views.register, name='register'), path(r"omega/", Omega.as_view(), name='omega'), path(r"loginf/", auth_views.LoginView.as_view( template_name='app/login.html'), name='login'), path(r"password-reset/", auth_views.PasswordResetView.as_view( template_name='app/password_reset.html'), name='password_reset'), path(r"password-reset/done/", auth_views.PasswordResetDoneView.as_view( template_name='app/password_reset_done.html'), name='password_reset_done'), path(r"password-reset-confirm/<uidb64>/<token>/", auth_views.PasswordResetConfirmView.as_view( template_name='app/password_reset_confirm.html'), name='password_reset_confirm'), path(r"password-reset-complete/", auth_views.PasswordResetCompleteView.as_view( template_name='app/password_reset_complete.html'), name='password_reset_complete'), path(r"logoutf/", views.logoutf, name='logout'), path(r"registerStudent/", views.registerStudent, name='registerStudent'), path(r"registerMentor/", views.registerMentor, name='registerMentor'), path(r"MentorPost/", views.MentorPost, name='MentorPost'), path(r"alpha/", views.alpha, name='alpha'), path(r"AlphaAdd/", views.AlphaAdd, name='AlphaAdd'), path(r"beta/", views.beta, name='beta'), path(r"UpdateProfile/", views.UpdateProfile, name='UpdateProfile'), path(r"post/<int:pk>/", PostDetailView.as_view(), name='SinglePost'), path(r"myposts/", PostListViewMentor.as_view(), name='MyPosts'), path(r"post/<int:pk>/update/", PostUpdateView.as_view(), name='UpdatePost'), path(r"post/<int:pk>/delete/", PostDeleteView.as_view(), name='DeletePost'), path(r"chat/",MessageCreate.as_view(),name ='Chat'), path(r"chat/inbox",Inbox.as_view(),name = 'Inbox'), path(r"chat/sentbox",Sentbox.as_view(),name = 'Sentbox') ]
CommentEditView, CommentDeleteView, PostCreateView, PostEditView, PostDeleteView, PostListView, PostDetailView, ) urlpatterns = [ url(r'^$', HomePageView.as_view(), name='home'), url(r'^admin/', admin.site.urls), url(r'^post/(?P<pk>[0-9]+)/comment/create$', CommentCreateView.as_view(), name='comment_create'), url(r'^post/(?P<pk>[0-9]+)/comment/(?P<pk_comment>[0-9]+)/edit$', CommentEditView.as_view(), name='comment_edit'), url(r'^post/(?P<pk>[0-9]+)/comment/(?P<pk_comment>[0-9]+)/delete$', CommentDeleteView.as_view(), name='comment_delete'), url(r'^post/$', PostListView.as_view(), name='post_list'), url(r'^post/(?P<pk>[0-9]+)/$', PostDetailView.as_view(), name='post_detail'), url(r'^post/(?P<pk>[0-9]+)$', PostCreateView.as_view(), name='post_create'), url(r'^post/(?P<pk>[0-9]+)$', PostEditView.as_view(), name='post_update'), url(r'^post/(?P<pk>[0-9]+)$', PostDeleteView.as_view(), name='post_delete'), ]