urlpatterns = [ # path('', post_list, name='index'), path('', IndexView.as_view(), name='index'), path('category/<int:category_id>/', CategoryView.as_view(), name='category-list'), path('tag/<int:tag_id>/', TagView.as_view(), name='tag-list'), # path('post/<int:post_id>.html', post_detail, name='post-detail'), path('post/<int:post_id>.html', PostDetailView.as_view(), name='post-detail'), path('search/', SearchView.as_view(), name='search'), path('author/<int:owner_id>/', AuthorView.as_view(), name='author'), path('links/', LinkListView.as_view(), name='links'), path('comment/', CommentView.as_view(), name='comment'), path('super_admin/', admin.site.urls, name='super-admin'), path('admin/', custom_site.urls, name='admin'), path('xadmin/', xadmin.site.urls, name='admin'), path('ckeditor/', include('ckeditor_uploader.urls')), path('category-autocomplete/', CategoryAutocomplete.as_view(), name='category-autocomplete'), path('tag-autocomplete/', TagsAutocomplete.as_view(), name='tag-autocomplete'), # path('api/post/', post_list, name='post-list'), # path('api/post/', PostList.as_view(), name='post-list'), path('api/', include((router.urls, 'blog'), namespace="api")), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
1. Import the include() function: from django.urls import include, path 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ import xadmin from django.contrib import admin from django.urls import path from django.conf.urls import url, include from django.conf import settings from django.conf.urls.static import static from blog.views import IndexView, CategoryView, TagView, PostDetailView, SearchView, AuthorView from config.views import LinkListView from comment.views import CommentView from .custom_site import custom_site from .autocomplete import CategoryAutoComplete, TagAutoComplete urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), url(r'^search/$', SearchView.as_view(), name='search'), url(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name='category-list'), url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name='tag-list'), url(r'^post/(?P<post_id>\d+).html$', PostDetailView.as_view(), name='post-detail'), url(r'^author/(?P<owner_id>\d+).html$', AuthorView.as_view(), name='author'), url(r'^links/$', LinkListView.as_view(), name='links'), url(r'^comment/$', CommentView.as_view(), name='comment'), url(r'^super_admin/', admin.site.urls, name='super-admin'), # url(r'^admin/', custom_site.urls, name='admin'), url(r'^admin/', xadmin.site.urls, name='xadmin'), url(r'^category-autocomplete/$', CategoryAutoComplete.as_view(), name='category-autocomplete'), url(r'^tag-autocomplete/$', TagAutoComplete.as_view(), name='tag-autocomplete'), url(r'^ckeditor/', include('ckeditor_uploader.urls')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
path('author/<int:owner_id>', AuthorView.as_view(), name='author'), path('category/<int:category_id>', CategoryView.as_view(), name='category-list'), path('tag/<int:tag_id>', TagView.as_view(), name='tag-list'), # 对应view中post_detail函数方法 # path('post/<int:post_id>.html', post_detail, name='post-detail'), # 对应于view中PostDetail类方法 path('post/<int:post_id>.html', PostDetailView.as_view(), name='post-detail'), path('search/', SearchView.as_view(), name='search'), path('links', LinkListView.as_view(), name='links'), path('super_admin/', admin.site.urls, name='super-admin'), path('admin/', custom_site.urls, name='admin'), path('comment/', CommentView.as_view(), name="comment"), path('rss|feed/', LatestPostFeed(), name="rss"), path( 'sitemap.xml', cache_page(60 * 20, key_prefix='sitemap_cache_')(sitemap_views.sitemap), {'sitemaps': { 'posts': PostSitemap }}), # path('api/post/', post_list, name="post-list"), # path('api/post/', PostList.as_view(), name="post-list"), path('api/', include((router.urls, "blog"), namespace="api")), path('api/docs/', include_docs_urls(title='typeidea apis')), ] if settings.DEBUG:
from main.views import AuthorView,SearchView,PostDetailView,IndexView,CategoryView,TagView from config.views import LinkView from comment.views import CommentView from .rss import LatestPostFeed from .sitemap import PostSitemap from main.apis import post_list,PostList,PostViewSet,CategoryViewSet router=DefaultRouter() router.register(r'post',PostViewSet,base_name='api-post') router.register(r'category',CategoryViewSet,base_name='api-category') urlpatterns = [ url(r'^$',IndexView.as_view(),name='index'), url(r'^author/(?P<author_id>\d+)',AuthorView.as_view(),name='author'), url(r'^search/$',SearchView.as_view(),name='search'), url(r'^comment/$',CommentView.as_view(),name="comment"), url(r'^category/(?P<category_id>\d+)$',CategoryView.as_view(),name='category_list'), url(r'^tag/(?P<tag_id>\d+)$',TagView.as_view(),name='tag_list'), url(r'^post/(?P<post_id>\d+).html$',PostDetailView.as_view(),name='post_detail'), url(r'^links$',LinkView.as_view(),name='links'), url(r'^rss/',LatestPostFeed(),name='rss'), url(r'^sitemap\.xml$',sitemap,{'sitemaps':{'posts':PostSitemap}}, name='django.contrib.sitemaps.views.sitemap'), url(r'^category-autocomplete/$',CategoryAutocomplete.as_view(),name='category-autocomplete'), url(r'^tag-autocomplete/$',TagAutocomplete.as_view(),name='tag-autocomplete'), url(r'^ckeditor/',include('ckeditor_uploader.urls')), url(r'^admin/', xadmin.site.urls,name='main_admin'), url(r'^super_admin/', permission_site.urls,name='super_admin'), url(r'^api/post_list/',post_list,name='post-list'), url(r'^api/postList/',PostList.as_view(),name='PostList'), url(r'^api/',include(router.urls,namespace='api')),
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 comment.views import CommentView from likes_and_dislikes.views import PostlikesToggleView from django.urls import path, include # import this so that to host static files from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('', include('home.urls', namespace='home')), path('admin/', admin.site.urls), path( 'accounts/', include( ('django.contrib.auth.urls', 'accounts'), namespace='accounts')), path('register/', include(('register.urls', 'register'), namespace='register')), path('<int:post_id>/', CommentView.as_view(), name='comment'), path('<int:post_id>/<slug:slug>/', PostlikesToggleView.as_view(), name='like-toggle'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from blog.views import post_list, post_detail, CategoryView, TagView, PostDetailView, IndexView, SearchView, AuthorView from comment.views import CommentView from config.views import LinkListView from .custom_site import custom_site from blog.sitemap import PostSitemap urlpatterns = [ re_path('^$', IndexView.as_view(), name='index'), re_path('^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name='category-list'), re_path('^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name='tag-list'), re_path('^post/(?P<post_id>\d+).html$', PostDetailView.as_view(), name='post-detail'), #re_path('^links/$', links, name='links'), re_path('^links/$', LinkListView.as_view, name='links'), re_path('^super_admin/', admin.site.urls, name='super-admin'), re_path('^admin/', custom_site.urls, name='admin'), re_path('^search/$', SearchView.as_view(), name='search'), re_path('^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name='author'), re_path('^comment/$', CommentView.as_view(), name='comment'), re_path('^sitemap\.xml$', sitemap_views.sitemap, {'sitemaps': { 'post': PostSitemap }}), re_path('^ckeditor/', include('ckeditor_uploader.urls')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from comment.views import CommentView urlpatterns = [ path('', CommentView.as_view({'get': 'list', 'post': 'create'})), path('<int:pk>', CommentView.as_view({'get': 'retrieve', 'put': 'update', 'delete': 'destroy'})) ]
from django.conf.urls import url from comment.views import CommentView urlpatterns = [ url(r'^comments$', CommentView.as_view()), ]
"""music URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.0/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.urls import path from comment.views import CommentView urlpatterns = [ path('<int:song_id>', CommentView.as_view(), name='comment'), ]
"""westagramProject URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.0/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 urlpatterns = [ path('admin/', admin.site.urls), ] ''' from django.urls import path from comment.views import CommentView app_name = 'comment' urlpatterns = [path('comment', CommentView.as_view())]
from django.conf.urls import url from comment.views import CommentView urlpatterns = [ url('^comment/(?P<pk>[0-9]+)/$', CommentView.as_view(), name='comment-view') ]
from django.urls import path from comment.views import CommentView urlpatterns = [ path('', CommentView.as_view()), ]
"""NewBlog URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.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.urls import path from comment.views import CommentView app_name = 'comment' urlpatterns = [ path('add_comment/<int:article_id>/', CommentView.as_view(), name='add_comment'), ]