from blog.views import AddSubscriptionView, CreatePostView, GetMyList, GetUserList,\ MarkPost, DeleteSubscriptionView, GetAllMyList, UserView,\ SubscriptionView, NoSubscriptionView, AllPosts, PostView, UserListView,\ PostTemplateView, LogoutView, FeedView, IndexView, PostListView,\ PostListAllView from django.contrib.auth import views as auth_views urlpatterns = [ path('login/', auth_views.LoginView.as_view(), name='login'), path('api/logout/', LogoutView.as_view()), path('list/', PostListView.as_view(), name='list'), path('list_all/', PostListAllView.as_view(), name='list_all'), path('list/<int:user_id>/', UserListView.as_view(), name='user_list'), path('feed/', FeedView.as_view(), name='feed'), path('post/<int:post_id>/', PostTemplateView.as_view(), name='post_view'), path('api/post/<int:post_id>/', PostView.as_view()), path('admin/', admin.site.urls), path('api/subscribe/<int:author_id>/', AddSubscriptionView.as_view()), path('api/unsubscribe/<int:author_id>/', DeleteSubscriptionView.as_view()), path('api/create-post/', CreatePostView.as_view()), path('api/list/', GetMyList.as_view()), path('api/list-all/', GetAllMyList.as_view()), path('api/feed/', AllPosts.as_view()), path('api/list/<int:user_id>/', GetUserList.as_view()), path('api/mark-read/<int:post_id>/', MarkPost.as_view()), path('api/users/', UserView.as_view()), path('api/subscriptions/', SubscriptionView.as_view()), path('api/nosubscriptions/', NoSubscriptionView.as_view()), re_path(r'^$', IndexView.as_view(), name='index'), ]
from django.conf.urls import url from blog.views import IndexView, PostView urlpatterns = [url(r"^$", IndexView.as_view()), url(r"^post/(?P<pk>[0-9]+)$", PostView.as_view())]
from django.conf.urls import patterns, url,include from blog.views import IndexView, TagView, PostView from django.contrib import admin urlpatterns = patterns( 'blog.views', url(r'^$', IndexView.as_view(), {'page': 1}, name='index'), url(r'^archive/$', 'archive', name='archive'), url(r'^posts/(?P<slug>.*?)/$', PostView.as_view(), name='post'), url(r'^page/(?P<page>\d+)/$', IndexView.as_view(), name='index'), url( r'^tag/(?P<slug>.*?)/page/(?P<page>\d+)/$', TagView.as_view(), name='tag' ), url(r'^tag/(?P<slug>.*?)/$', TagView.as_view(), name='tag'), url(r'^admin/', include(admin.site.urls)), #url(r'^new/$', 'editor', name='new_post'), #url(r'^edit/(?P<slug>.*?)/$', 'editor', name='edit_post'), #url(r'^feed/$', 'feed', name='feed'), )
from django.conf.urls import url from django.contrib import admin from blog.views import IndexPageView, CommentApiView, PostView, TagListView urlpatterns = [ url(r'^$', IndexPageView.as_view()), url(r'^post/(?P<pk>[\d]+)$', PostView.as_view(), name='post-detail'), url(r'^tags$', TagListView.as_view(), name='tag-list'), url(r'^api/comments/$', CommentApiView.as_view(), name='comment-api') ]
"""website URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') Class-based views 1. Add an import: from other_app.views import Home 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 1. Add an import: from blog import urls as blog_urls 2. Add a URL to urlpatterns: url(r'^blog/', include(blog_urls)) """ from django.conf.urls import url from blog.views import BlogView, PostView urlpatterns = [ url(r'^$', BlogView.as_view()), url(r'(.*)/', PostView.as_view()) ]
from django.conf.urls import patterns, include, url from django.conf.urls.defaults import * from blog.models import * from blog.views import PostView, Main, ArchiveMonth # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'dbe.views.home', name='home'), # url(r'^dbe/', include('dbe.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), ) urlpatterns += patterns("blog.views", (r"^post/(?P<dpk>\d+)/$" , PostView.as_view(), {}, "post"), (r"^archive_month/(\d+)/(\d+)/$" , ArchiveMonth.as_view(), {}, "archive_month"), (r"^$" , Main.as_view(), {}, "main"), # (r"^delete_comment/(\d+)/$" , "delete_comment", {}, "delete_comment"), )
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 django.conf.urls import url from blog.views import (MainPageView, SignUpView, LoginView, LogoutView, ProfileView, NewPostView, MyDeleteView, PostView, UpdatePostView) from django.conf.urls.static import static from django.conf import settings urlpatterns = [ path('admin/', admin.site.urls, name='admin'), re_path('signup', SignUpView.as_view(), name='signup'), re_path('login', LoginView.as_view(), name='login'), re_path('logout', LogoutView.as_view(), name='logout'), re_path('profile/', ProfileView.as_view(), name='profile'), re_path('newpost', NewPostView.as_view(), name='newpost'), re_path('posts/(?P<pid>\d+)', PostView.as_view(), name='post'), re_path('update_post/(?P<pk>\d+)', UpdatePostView.as_view(), name='update'), re_path( 'delete_post/(?P<pk>\d+)', MyDeleteView.as_view(), name='delete_post'), url(r'^$', MainPageView.as_view(), name='index'), re_path('index', MainPageView.as_view()), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import url from blog.views import ( BlogListView, BlogView, FeedView, SubscribeView, ViewedView, PostView, PostAddView, LogoutView, LoginView ) urlpatterns = [ url(r'^$', BlogListView.as_view(), name='blog_list'), url(r'^view/blog/(?P<id>\d+)/$', BlogView.as_view(), name='blog_view'), url(r'^view/post/(?P<id>\d+)/$', PostView.as_view(), name='post_view'), url(r'^add/$', PostAddView.as_view(), name='post_add'), url(r'^subscribe/(?P<id>\d+)/$', SubscribeView.as_view(), name='subscribe_view'), url(r'^viewed/(?P<id>\d+)/$', ViewedView.as_view(), name='viewed_view'), url(r'^feed/$', FeedView.as_view(), name='blog_feed'), url(r'^logout/$', LogoutView.as_view(), name='blog_logout'), url(r'^login/$', LoginView.as_view(), name='blog_login'), ]
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.contrib import admin from django.urls import path from django.conf.urls.static import static from django.views.generic import TemplateView from user_login.views import UserFormView, UserInfoView, LoginHandler, logout_handler from blog.views import ProfileView from blog.views import PostView urlpatterns = [ path('admin/', admin.site.urls), path('login/', LoginHandler.as_view(), name='login_handler'), path('logout/',logout_handler, name="logout"), path('', UserFormView.as_view(), name='homeview'), path('info/', UserInfoView.as_view(), name='info'), path('profile/',ProfileView.as_view(), name="profile"), path('posts/', PostView.as_view(), name="posts") ] if settings.DEBUG: urlpatterns += static(settings.STATIC_URL, document_root = settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
## Feeds from blog.feeds import RssBlogNewsFeed, AtomBlogNewsFeed sitemaps = {'main': SitemapStatic, 'blog': SitemapBlog} urlpatterns = patterns('', url('^$', BlogView.as_view(), name='blog'), url('^portfolio/$', PortfolioView.as_view(), name='portfolio'), url('^projects/$', ProjectsView.as_view(), name='project'), url('^about/$', TemplateView.as_view(template_name='about.html'), name='about'), url('^themes/(?P<theme>[^/]+)/$', ThemeView.as_view(), name='theme'), url('^(?P<year>\d{4})/$', PostYearArchiveView.as_view(), name='year_archive'), url('^(?P<year>\d{4})/(?P<month>\d+)/$', PostMonthArchiveView.as_view(month_format='%m'), name='month_archive'), url('^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<slug>[\w-]+)/$', PostView.as_view(), name='post'), url('^feeds/rss/$', RssBlogNewsFeed(), name='rssfeed'), url('^feeds/atom/$', AtomBlogNewsFeed(), name='atomfeed'), url('^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}, name='sitemap'), url('^search/', include('haystack.urls')), url('^login/$', 'core.views.auth_login', name='login'), url('^logout/$', 'core.views.auth_logout', name='logout'), url('^admin/', include(admin.site.urls)), )
SubCategoryView, UserPostListView, PostCreateView, PostUpdateView, PostDeleteView, SearchView ) urlpatterns = [ path('admin/', admin.site.urls), path('', HomeView.as_view(), name="home"), path('search/', SearchView.as_view(), name="search"), path('topic/<slug:slug>/', CategoryView.as_view(), name="category"), path('topic/<slug:category>/<slug:slug>', SubCategoryView.as_view(), name="subcategory"), path('<slug:slug>', PostView.as_view(), name="post"), path('profile/<slug:username>/', ProfileView.as_view(), name='profile'), #Auth System path('account/signin/', LoginView.as_view(template_name='auth/login.html', redirect_authenticated_user=True, extra_context={'title_page':'Sign in', 'breadcrumb':[(reverse_lazy('home'),'Inicio'), ('','Iniciar Sesión')]} ), name='signin'), path('account/logout/', LogoutView.as_view(), name='logout'), path('account/signup/', register_view, name='signup'), path('account/<slug:pt>/', UserPostListView.as_view(), name='user_post'),
-- 1. Import the include() function: `from django.conf.urls import url, include` 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 django.views.generic import TemplateView from recipe.views import RecipeDetailView, RecipeListView from blog.views import PostView urlpatterns = [ url(r'^redactor/', include('redactor.urls')), url(r'^$', TemplateView.as_view(template_name='index.html')), url(r'^admin/', admin.site.urls), url(r'^posts/(?P<slug>[-\w\d\_]+)/$', PostView.as_view(), name='post_view'), url(r'^recipes/list/', RecipeListView.as_view()), url(r'^recipes/(?P<slug>[-\w\d\_]+)/$', RecipeDetailView.as_view(), name='recipe_view') ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from blog.views import BlogListView, BlogDetailView, PostView, BlogSiteView, BlogPostView urlpatterns = [ path("blogs/", BlogListView.as_view()), path("blogs/<int:blog_id>/", BlogDetailView.as_view()), path("blogs/<str:site>/", BlogSiteView.as_view()), path("blogs/<int:blog_id>/posts/<int:post_id>/", PostView.as_view()), path("blogs/<str:site>/posts/", BlogPostView.as_view()) ]
router.register(r'category', CategoryViewSet) router.register(r'tag', TagViewSet) router.register(r'user', UserViewSet) def static(prefix, **kwargs): return [ url(r'^%s(?P<path>.*)$' % re.escape(prefix.lstrip('/')), serve, kwargs=kwargs), ] urlpatterns = [ path('', IndexView.as_view(), name='index'), path('post/<int:pk>/', PostView.as_view(), name='detail'), path('category/<int:category_id>/', CategoryView.as_view(), name='category'), path('tag/<int:tag_id>/', TagView.as_view(), name='tag'), path('author/<int:author_id>/', AuthorView.as_view(), name='author'), path('links/', LinkView.as_view(), name='links'), path('comments/', CommentView.as_view(), name='comments'), path('admin/', xadmin.site.urls), url(r'^category-autocomplete/$', CategoryAutocomplete.as_view(), name='category-autocomplete'), url(r'^tag-autocomplete/$', TagAutocomplete.as_view(), name='tag-autocomplete'), # path('category-autocomplete/', CategoryAutoComplete.as_view(),
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, re_path from blog.views import IndexView, PostView, TagView, ArchiveView, CategoryView, SearchView app_name = "blog" urlpatterns = [ re_path('^$', IndexView.as_view(), name='index'), re_path('post/(?P<pk>[0-9]+)/', PostView.as_view(), name='detail'), #文章归档目录页 re_path('tag/(?P<pk>[0-9]+)/', TagView.as_view(), name='tag'), #导航分类页 re_path('category/(?P<pk>[0-9]+)/', CategoryView.as_view(), name='category'), #文章归档目录页 re_path('archive/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/', ArchiveView.as_view(), name='archive'), #搜索页
from fastapi import APIRouter from blog.views import PostView from blog.schemas import PostSchema router = APIRouter() view = PostView() @router.get('/posts') async def list_post(): return await view.list(('author', )) @router.post('/posts') async def create_post(post: PostSchema): return await view.store(**post.dict())
from django.conf.urls.defaults import patterns, include, url from blog.views import PostListView, PostView from blog.models import Post, NewsPost, PhotoPost, VideoPost, QuotePost, Tag import settings # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', url(r'^$', PostListView.as_view(model=Post)), url(r'^news/(?P<pk>\d+)/?', PostView.as_view(model=NewsPost, template_name="blog/post_detail.html")), url(r'^photos/(?P<pk>\d+)/?', PostView.as_view(model=PhotoPost, template_name="blog/post_detail.html")), url(r'^videos/(?P<pk>\d+)/?', PostView.as_view(model=VideoPost, template_name="blog/post_detail.html")), url(r'^quotes/(?P<pk>\d+)/?', PostView.as_view(model=QuotePost, template_name="blog/post_detail.html")), url(r'^news/?', PostListView.as_view(model=NewsPost, queryset=NewsPost.objects.all(), template_name="blog/post_list.html")), url(r'^photos/?', PostListView.as_view(model=PhotoPost, queryset=PhotoPost.objects.all(), template_name="blog/post_list.html")), url(r'^videos/?', PostListView.as_view(model=VideoPost, queryset=VideoPost.objects.all(), template_name="blog/post_list.html")), url(r'^quotes/?', PostListView.as_view(model=QuotePost, queryset=QuotePost.objects.all(), template_name="blog/post_list.html")), url(r'^media/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, }), # Examples: # url(r'^$', 'topplr.views.home', name='home'), # url(r'^topplr/', include('topplr.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation:
from django.conf.urls import url from blog.views import PostListView, PostView, CommentListView, CommentView urlpatterns = [ url('posts', PostListView.as_view()), url('post/(?P<id>[0-9]+)', PostView.as_view()), url('post', PostView.as_view()), url('comments', CommentListView.as_view()), url('comment/(?P<id>[0-9]+)', CommentView.as_view()), url('comment', CommentView.as_view()), ]
xadmin.autodiscover() xversion.register_models() router = routers.DefaultRouter() router.register(r'post', PostViewSet) router.register(r'category', CategoryViewSet) router.register(r'tag', TagViewSet) router.register(r'user', UserViewSet) urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), url(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name='category'), url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name='tag'), url(r'^post/(?P<pk>\d+)/$', PostView.as_view(), name='detail'), url(r'^author/(?P<author_id>\d+)/$', AuthorView.as_view(), name='author'), url(r'^links/$', LinkView.as_view(), name='links'), url(r'^comment/$', CommentView.as_view(), name='comment'), url(r'^admin/', xadmin.site.urls), url(r'^category-autocomplete/$', CategoryAutocomplete.as_view(), name='category-autocomplete'), url(r'^tag-autocomplete/$', TagAutocomplete.as_view(), name='tag-autocomplete'), url(r'^api/', include(router.urls)), url(r'^api/docs/', include_docs_urls(title='Typeidea apis')), ] if settings.DEBUG:
# -*- coding: utf-8 -*- from django.conf.urls.defaults import * from blog.models import * from blog.views import PostView, Main, ArchiveMonth urlpatterns = patterns('blog.views', (r"^post/(?P<dpk>\d+)/$", PostView.as_view(), {}, 'post'), (r"^archive_month/(\d+)/(\d+)/$", ArchiveMonth.as_view(), {}, 'archive_month'), (r"^$", Main.as_view(), {}, 'main') #(r"^delete_comment/(\d+)/$", "delete_comment", {}, "delete_comment"), )
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.conf.urls import url from django.contrib import admin from django.urls import path from rest_framework.urlpatterns import format_suffix_patterns from blog import views from rest_framework.authtoken import views as restView from blog.views import PostView, CommentView # test() urlpatterns = [ path('admin/', admin.site.urls), path('users/', views.UserList.as_view()), path('login/', views.login_user), path('signup/', views.signup), path('delete/<str:username>/', views.user_detail), path('token/', views.token), path('gettoken/', restView.obtain_auth_token), url(r'^post/', PostView.as_view()), url(r'^comment/', CommentView.as_view()), ] urlpatterns = format_suffix_patterns(urlpatterns)
from django.conf.urls import patterns, url from blog.views import IndexView, TagView, PostView urlpatterns = patterns( "blog.views", url(r"^$", IndexView.as_view(), {"page": 1}, name="index_1"), url(r"^feed/$", "feed", name="feed"), url(r"^archive/$", "archive", name="archive"), url(r"^post/(?P<slug>.*?)/$", PostView.as_view(), name="post"), url(r"^page/(?P<page>\d+)/$", IndexView.as_view(), name="index"), url(r"^tag/(?P<slug>.*?)/page/(?P<page>\d+)/$", TagView.as_view(), name="tag"), url(r"^tag/(?P<slug>.*?)/$", TagView.as_view(), name="tag_1"), url(r"^new/$", "editor", name="new_post"), url(r"^edit/(?P<slug>.*?)/$", "editor", name="edit_post"), )
from django.conf.urls import url from blog.views import PostListView, PostView helper_patterns = [ url(r'^blog/$', PostListView.as_view(), name='post'), url(r'^blog/(?P<pk>[0-9]+)/$', PostView.as_view(), name='get_post'), ] urlpatterns = helper_patterns
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.conf.urls import url from django.contrib import admin from django.urls import path from blog.views import IndexView, CategoryView, TagView, PostView from typeidea.custom_site import custom_site # from config urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), 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$', PostView.as_view(), name='post-detail'), # # url(r'^links/$', links, name='links'), url(r'super_admin/', admin.site.urls, name='super-admin'), url(r'admin/', custom_site.urls, name='admin') ]
# -*- coding:utf-8 -*- from django.urls import re_path, path from blog.views import MarkPostView, PostView urlpatterns = [ re_path(r'(?P<pk>\d+)/mark', MarkPostView.as_view(), name='mark_post'), re_path(r'(?P<pk>\d+)/', PostView.as_view(), name='post'), # re_path(r'(?P<blog_id>\d+)/post/(?P<post_id>\d+)/update', PostUpdateView.as_view(), name='post_update'), ]
from django.conf.urls.defaults import url, patterns from blog.views import HomeView, PostListView, PostView, LoginView, AboutMe urlpatterns = patterns( '', url(r'^$', HomeView.as_view(), name='home'), url(r'^login/$', LoginView.as_view(), {"login": True}, name='login'), url(r'^logout/$', LoginView.as_view(), {"login": False}, name='logout'), url(r'^blog/$', PostListView.as_view(), name='blog'), url(r'^blog/post/$', PostView.as_view(), name='new_post'), url(r'^blog/post/(?P<slug>[\w-]+)/$', PostView.as_view(), name='blog_post'), url(r'^about_me/$', AboutMe.as_view(), name='about_me'), )
from django.urls import path from blog.views import (SignUpView, Activate, RepeatEmailView, MyProfile, PostView, AuthorSearchView, CategorySearchView, CreatePostView, PostChangeView, NameSearchView, TagListViews, comment_create_view, CommentDeleteView) urlpatterns = [ path('signup/', SignUpView.as_view(), name='signup'), path('repeat/', RepeatEmailView.as_view(), name='repeat_email'), path('create/', CreatePostView.as_view(), name='create_post'), path('comment_add/<slug:slug>', comment_create_view, name='create_comment'), path('post/<slug:slug>', PostView.as_view(), name='post_view'), path('profile/<int:pk>', MyProfile.as_view(), name='profile'), path('postchange/<int:pk>', PostChangeView.as_view(), name='post_change'), path('deletecomment/<uuid:pk>', CommentDeleteView.as_view(), name='delete_comment'), path('authorsearch/<int:pk>', AuthorSearchView.as_view(), name='author_search'), path('postswithtag/<slug:slug>', TagListViews.as_view(), name='tag_search'), path('namesearch/', NameSearchView.as_view(), name='name_search'), path('categorysearch/<slug:slug>', CategorySearchView.as_view(), name='category_search'), path('activate/<uuid:activation_code>/', Activate.as_view(), name='activate'), ]
from django.urls import path, include from . import views from blog.views import HomeView, PostView, PostbroView urlpatterns = [ path('', HomeView.as_view(), name='home'), path('article/<int:pk>', PostView.as_view(), name='art-detail'), path('postbro/', PostbroView.as_view(), name='postbro'), ]
1. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from django.conf.urls import url from django.contrib import admin import xadmin from django.views.static import serve from blog.views import IndexView, PostView, AboutView, ArchiveView, CategoryView, CategoryPostView from .settings import MEDIA_ROOT urlpatterns = [ url(r'^xadmin/', xadmin.site.urls), url(r'^$', IndexView.as_view(), name="index"), # 文章详情页 url(r'^post/(?P<post_id>\d+)/$', PostView.as_view(), name="post"), # 关于作者 url(r'^about/$', AboutView.as_view(), name="about"), # 登陆 url(r'^login/$', AboutView.as_view(), name="login"), # 注册 url(r'^register/$', AboutView.as_view(), name="register"), # 归档 url(r'^archives/$', ArchiveView.as_view(), name="archives"), # 分类 url(r'^categories/$', CategoryView.as_view(), name="categories"), # url(r'^static/(?P<path>.*)$', serve, {"document_root":STATIC_ROOT}), # 同种分类文章 url(r'^category/(?P<category_id>\d+)/$',
from django.conf.urls import url, static, include from django.contrib import admin from django.conf import settings from django.contrib.auth.views import login from .views import HomeView from reservation.views import ReservationView, \ ReservationCompleteView, AcknowledgeReservataion from blog.views import BlogView, PostView urlpatterns = [ url(r'^$', HomeView.as_view(), name='home'), url(r'^admin/', admin.site.urls), url(r'^accounts/login/$', login, kwargs={"template_name": "admin/login.html"}), url(r'^reservation-complete/(?P<reservation_id>\d+)/$', ReservationCompleteView.as_view(), name='reservation-complete'), url(r'^reserve/(?P<branch_code>\w+)/$', ReservationView.as_view(), name='reserve'), url(r'^acknowledge-reservation/(?P<reservation_id>\d+)/$', AcknowledgeReservataion.as_view(), name='acknowledge-reservation'), url(r'^blog/$', BlogView.as_view(), name='blog'), url(r'^blog/(?P<slug>[\w-]+)/$', PostView.as_view(), name='blog_post'), url(r'^tinymce/', include('tinymce.urls')), url(r'^(?P<code>\w+)/$', HomeView.as_view(), name='home'), ] + static.static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.urls import path from blog.views import PostView,PostDetail,PostCreate,PostUpdate,PostDelete,likeView,add_comment_to_post app_name = 'blog' urlpatterns = [ path('',PostView.as_view(), name = 'post-list'), path('detail/<int:pk>/',PostDetail.as_view(), name = 'post-detail'), path('create/',PostCreate.as_view(), name = 'post-create'), path('update/<int:pk>/',PostUpdate.as_view(), name = 'post-update'), path('delete/<int:pk>/',PostDelete.as_view(), name = 'post-delete'), path('ajax/likes/',likeView, name = 'like'), path('detail/<int:pk>/comment/',add_comment_to_post,name = 'post-comment'), ]
from django.conf.urls import url from blog.views import IndexView, PostView, CommentView, RepositoryView, RepositoryDetailView, TagListView, \ CategoryListView, AuthorPostListView, CommentDeleteView urlpatterns = [ url(r'^$', IndexView.as_view()), url(r'^post/(?P<pk>[0-9]+)$', PostView.as_view()), url(r'^comment/add/(?P<pk>[0-9]+)$', CommentView.as_view()), url(r'^comment/delete/(?P<pk>[0-9]+)$', CommentDeleteView.as_view()), url(r'^repository$', RepositoryView.as_view()), url(r'^repository/(?P<pk>[0-9]+)$', RepositoryDetailView.as_view()), url(r'^tag/(?P<slug>[\w\u4e00-\u9fa5]+)$', TagListView.as_view()), url(r'^category/(?P<slug>[\w\u4e00-\u9fa5]+)$', CategoryListView.as_view()), url(r'^author/(?P<pk>[0-9]+)$', AuthorPostListView.as_view()) ]
from django.conf.urls import patterns, include, url from blog.views import PostView, Main, ArchiveMonth from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Examples: # url(r'^$', 'myBlog.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/' , include(admin.site.urls)), url(r'^post/(?P<dpk>\d+)/$' , PostView.as_view(), {}, 'post'), url(r'^archive_month/(\d+)/(\d+)/$' , ArchiveMonth.as_view(), {}, 'archive_month'), url(r'^$' , Main.as_view(), {}, 'main'), # (r"^delete_comment/(\d+)/$" , "delete_comment", {}, "delete_comment"), )
from django.urls import path, re_path from blog.views import blog_view, blog_info, PostView urlpatterns = [ path('', PostView.as_view()), re_path('(?P<pk>\d+)/', blog_view), path('info/', blog_info), ]
from django.urls import path from blog.views import (PostView, PostsView, CategoryView, AddPostView, EditPostView, add_comment, like_comment, get_comments) from .api import PostViewSet, CategoryViewSet, CommentViewSet from core.urls import router router.register(r'post_viewset', PostViewSet) router.register(r'category_viewset', CategoryViewSet) router.register(r'comment_viewset', CommentViewSet) app_name = 'blog' urlpatterns = [ path('', PostsView.as_view(), name='home'), path('post/<slug:slug>/', PostView.as_view(), name='post'), path('category/<str:cat>/', CategoryView.as_view(), name='category'), path('add_post/', AddPostView.as_view(), name='add_post'), path('edit_post/<slug:slug>/', EditPostView.as_view(), name='edit_post'), path('add_comment/', add_comment, name='add_comment'), path('comment_like/', like_comment, name='like_comment'), path('get_comments/<slug:slug>/', get_comments, name='comments'), ]
'', url(r'^admin/', include(admin.site.urls)), url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': sitemaps}), url(r'^logout/$', 'django.contrib.auth.views.logout', name='logout', kwargs={'next_page': '/'}), # Yandex access url(r'yandex_4176ffddb576e745.html$', 'webblog.views.yandex_access'), # robot.txt url(r'robots\.txt', 'webblog.views.robots'), url(r'^$', Home.as_view(), name='home'), url(r'^category/(?P<category>[_a-zA-Z0-9]+)/$', CategoryView.as_view(), name='category'), url(r'^tag/(?P<tag>[_a-zA-Z0-9]+)/$', TagView.as_view(), name='tag'), url(r'^post/(?P<post>[_a-zA-Z0-9/-]+)/$', PostView.as_view(), name='post'), # url(r'^webblog/', include('webblog.foo.urls')), # Uncomment the admin/doc line below to enable admin documentation: # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), ) if settings.DEBUG: urlpatterns = patterns( '', url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT, 'show_indexes': True}), ) + urlpatterns
`url(r'^$', Home.as_view(), name='home')` Including another URL conf -- 1. Import the include() function: `from django.conf.urls import url, include` 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 django.views.generic import TemplateView from recipe.views import RecipeDetailView, RecipeListView from blog.views import PostView urlpatterns = [ url(r'^redactor/', include('redactor.urls')), url(r'^$', TemplateView.as_view(template_name='index.html')), url(r'^admin/', admin.site.urls), url(r'^posts/(?P<slug>[-\w\d\_]+)/$', PostView.as_view(), name='post_view'), url(r'^recipes/list/', RecipeListView.as_view()), url(r'^recipes/(?P<slug>[-\w\d\_]+)/$', RecipeDetailView.as_view(), name='recipe_view') ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
from django.conf.urls import patterns, url from blog.views import IndexView, TagView, PostView urlpatterns = patterns( 'blog.views', url(r'^$', IndexView.as_view(), {'page': 1}, name='index'), url(r'^feed/$', 'feed', name='feed'), url(r'^archive/$', 'archive', name='archive'), url(r'^post/(?P<slug>.*?)/$', PostView.as_view(), name='post'), url(r'^page/(?P<page>\d+)/$', IndexView.as_view(), name='index'), url(r'^tag/(?P<slug>.*?)/page/(?P<page>\d+)/$', TagView.as_view(), name='tag'), url(r'^tag/(?P<slug>.*?)/$', TagView.as_view(), name='tag'), url(r'^new/$', 'editor', name='new_post'), url(r'^edit/(?P<slug>.*?)/$', 'editor', name='edit_post'), )
from django.conf.urls import url from django.views.decorators.cache import cache_page from blog.views import IndexView, PostView, CommentView, RepositoryView, RepositoryDetailView, TagListView, \ CategoryListView, AuthorPostListView, CommentDeleteView,ProductView, DocumentView, ApiTest, DocumentListView, \ AlbumListView urlpatterns = [ url(r'^$', cache_page(2592000)(IndexView.as_view())), #youzi cache 30 days #url(r'^document$', DocumentListView.as_view()), url(r'^album/(?P<pk>[0-9]+)$', AlbumListView.as_view()), url(r'^document/(?P<pk>[0-9]+)$', DocumentView.as_view()), url(r'^product/(?P<pk>[0-9]+)$', ProductView.as_view()), url(r'^post/(?P<pk>[0-9]+)$', PostView.as_view()), url(r'^comment/add/(?P<pk>[0-9]+)$', CommentView.as_view()), url(r'^comment/delete/(?P<pk>[0-9]+)$', CommentDeleteView.as_view()), url(r'^repository$', RepositoryView.as_view()), url(r'^repository/(?P<pk>[0-9]+)$', RepositoryDetailView.as_view()), url(r'^tag/(?P<slug>[\w\u4e00-\u9fa5]+)$', TagListView.as_view()), url(r'^category/(?P<slug>[\w\u4e00-\u9fa5]+)$', CategoryListView.as_view()), url(r'^author/(?P<pk>[0-9]+)$', AuthorPostListView.as_view()), url(r'^api/(?P<pid>[0-9]+)/(?P<mid>[0-9]+)$', ApiTest) ]
from django.urls import path from blog.views import get_profile, get_my_age, PostView, CommentView urlpatterns = [ path('hello/', get_profile), path('my-age/', get_my_age), path('posts/', PostView.as_view()), path('comments/', CommentView.as_view()) ]
# from django.conf.urls import patterns, include, url # # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() # urlpatterns = patterns('', # # Examples: # # url(r'^$', 'dbe.views.home', name='home'), # # url(r'^dbe/', include('dbe.foo.urls')), # # Uncomment the admin/doc line below to enable admin documentation: # # url(r'^admin/doc/', include('django.contrib.admindocs.urls')), # # Uncomment the next line to enable the admin: # # url(r'^admin/', include(admin.site.urls)), # ) from django.conf.urls import * from blog.models import * from blog.views import PostView, Main, ArchiveMonth urlpatterns = patterns("dbe.blog.views", (r"^post/(?P<dpk>\d+)/$" , PostView.as_view(), {}, "post"), (r"^archive_month/(\d+)/(\d+)/$" , ArchiveMonth.as_view(), {}, "archive_month"), (r"^$" , Main.as_view(), {}, "main"), # (r"^delete_comment/(\d+)/$" , "delete_comment", {}, "delete_comment"), # Uncomment the next line to enable the admin: url(r'^admin/', include(admin.site.urls)), )
from blog.views import (IndexView, CategoryView, TagView, PostView, AuthorView, SearchView) from blog.rss import LatestPostFeed from blog.sitemap import PostSitemap from config.views import LinkListView from comment.views import CommentView urlpatterns = [ path('super-admin/', admin.site.urls), path('admin/', custom_site.urls), #以上admin.site是自带的一个site,而custom_site是我们自定义的site url(r'^$', IndexView.as_view(), name='all_posts'), url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name='tag'), url(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name='category'), url(r'^author/(?P<author_id>\d+)/$', AuthorView.as_view(), name='author'), url(r'^search/$', SearchView.as_view(), name='search'), url(r'^post_detail/(?P<post_id>\d+).html$', PostView.as_view(), name='post_detail'), url(r'^links/$', LinkListView.as_view(), name='links'), url(r'^comment/$', CommentView.as_view(), name='comment'), url(r'^rss/$', LatestPostFeed(), name='rss'), url(r'^sitemap\.xml$', sitemap_views.sitemap, {'sitemaps': { 'posts': PostSitemap }}, name='sitemap'), ]