AuthorView, ) from config.views import LinkView from comment.views import CommentView from typeidea.autocomplete import CategoryAutocomplete, TagAutocomplete # from blog.apis import post_list, PostList from blog.apis import PostViewSet, CategoryViewSet, TagViewSet router = DefaultRouter() # 这里的basename就类似于名称空间,即url reverse的前缀。 router.register(r'post', PostViewSet, basename="api-post") router.register(r'category', CategoryViewSet, basename="api-category") router.register(r'tag', TagViewSet, basename="api-tag") urlpatterns = [ url(r'^$', IndexView.as_view(), name="post_list"), url(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name="post_list_by_category"), url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name="post_list_by_tag"), url(r'^author/(?P<author_id>\d+)/$', AuthorView.as_view(), name="post_list_by_author"), url(r'^post/(?P<post_id>\d+).html/$', PostDetailView.as_view(), name="post_detail"), url(r'^keyword/$', SearchView.as_view(), name="search"), url(r'^links/$', LinkView.as_view(), name="links"), url(r'^comment/$', CommentView.as_view(), name="comment"), url(r'^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.conf.urls import url from django.contrib import admin from blog.views import IndexView, CategoryView, TagView, PostDetailView, SearchView, AuthorView from config.views import links from .custom_site import custom_site 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$', PostDetailView.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'), url(r'^search/$', SearchView.as_view(), name='search'), url(r'^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name='author'), ] # from django.contrib import admin
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 url from blog.views import IndexView, ArticleDetailView, CategoryView, custom, ArticleList, ArticleDetail, TagsView, about urlpatterns = [ # 首页调用IndexView url(r'^$', IndexView.as_view(), name='index'), url(r'^index.html/$', IndexView.as_view(), name='index'), # .html 处理方式不对哦 # 使用(?P<>\d+)的形式捕获值给<>中得参数,比如(?P<article_id>\d+),当访问/blog/article/3时, # 将会将3捕获给article_id,这个值会传到views.ArticleDetailView,这样我们就可以判断展示哪个Article了 url(r'article/(?P<article_id>\d+)$', ArticleDetailView.as_view(), name='detail'), url(r'category/(?P<cate_id>\d+)$', CategoryView.as_view(), name='category'), url(r'^custom/$', custom), url(r'^tags/$', TagsView.as_view(), name='tags'), url(r'^about/$', about, name='about'), # api url(r'api/v1/articles$', ArticleList.as_view()), url(r'api/v1/articles/(?P<article_id>\d+)$', ArticleDetail.as_view()), ]
from django.conf.urls import url from django.contrib.sitemaps import views as sitemap_views from .custom_site import custom_site 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
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, include from blog.views import IndexView, donate_index, charge, successMSG from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path('', IndexView.as_view(), name='home'), path('accounts/', include('accounts.urls', namespace='accounts')), path('', include('django_registration.backends.activation.urls')), path('blog/', include('blog.urls', namespace='blog')), path('donate/', donate_index, name='donate'), path('charge/', charge, name='charge'), path('donate/<str:amount>/success', successMSG, name='donate_success'), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) '''django_registration_register is the account-registration view. django_registration_complete is the post-registration success message. django_registration_activate is the account-activation view. django_registration_activation_complete is the post-activation success message. django_registration_disallowed is a message indicating registration is not currently permitted'''
from django.conf.urls import url from blog.views import IndexView,ArticleView,AllView,SearchView,ColumnView,UserView,NewsView,TagView,CategoryView from django.views.generic import TemplateView,DetailView from blog.models import News urlpatterns = [ url(r'^$',IndexView.as_view(),name='home',kwargs={'page_num':1}), url(r'^article/(?P<slug>\w+).html$',ArticleView.as_view()), url(r'^all/$',AllView.as_view()), url(r'^search/$',SearchView.as_view()), url(r'^login/$',TemplateView.as_view(template_name="blog/login.html")), url(r'^register/$',TemplateView.as_view(template_name="blog/register.html")), url(r'^forgetpassword/$',TemplateView.as_view(template_name="blog/forgetpassword.html")), url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',TemplateView.as_view(template_name="blog/resetpassword.html")), url(r'^column/(?P<column>\w+)$',ColumnView.as_view()), url(r'^user/(?P<slug>\w+)$',UserView.as_view()), url(r'^news/$',NewsView.as_view()), url(r'^news/(?P<pk>\w+)$',DetailView.as_view(model=News)), url(r'^tag/(?P<tag>\w+)/$',TagView.as_view()), url(r'^category/(?P<category>\w+)/$',CategoryView.as_view()), ]
from django.conf.urls import url from blog.views import IndexView,ArticleView,AllView,SearchView,ColumnView,UserView,NewsView,TagView,CategoryView from django.views.generic import TemplateView,DetailView from blog.models import News urlpatterns = [ url(r'^$',IndexView.as_view()), url(r'^article/(?P<slug>\w+).html$',ArticleView.as_view()), url(r'^all/$',AllView.as_view()), url(r'^search/$',SearchView.as_view()), url(r'^login/$',TemplateView.as_view(template_name="blog/login.html")), url(r'^register/$',TemplateView.as_view(template_name="blog/register.html")), url(r'^forgetpassword/$',TemplateView.as_view(template_name="blog/forgetpassword.html")), url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',TemplateView.as_view(template_name="blog/resetpassword.html")), url(r'^column/(?P<column>\w+)$',ColumnView.as_view()), url(r'^user/(?P<slug>\w+)$',UserView.as_view()), url(r'^news/$',NewsView.as_view()), url(r'^news/(?P<pk>\w+)$',DetailView.as_view(model=News)), url(r'^tag/(?P<tag>\w+)/$',TagView.as_view()), url(r'^category/(?P<category>\w+)/$',CategoryView.as_view()), ]
from django.contrib import admin from django.urls import path, include from blog.views import IndexView, CategoryIndexView, BlogDetailView, ContactFormView, PostModelFormView, PostFormUpdateView urlpatterns = [ path('', IndexView.as_view()), path('contact', ContactFormView.as_view()), path('posts', PostModelFormView.as_view()), path('posts/<slug:slug>', PostFormUpdateView.as_view(), name='update-post'), path('<slug:slug>', BlogDetailView.as_view(), name='post-detail'), ]
from django.urls import path from blog.views import blog_single, IndexView urlpatterns = [ path('', IndexView.as_view(), name='blog_index'), path('blog_single/<int:pk>/', blog_single, name='blog_single') ]
from django.conf.urls import url from blog.views import IndexView, BlogView, AboutView, ContactView, DetailView, ArchivesView, CategoryView, TagView urlpatterns = [ url(r'^$', IndexView.as_view(), name='首页'), url(r'^detail/(?P<pk>[0-9]+)/$', DetailView.as_view(), name='详情'), url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$', ArchivesView.as_view(), name='归档'), url(r'^category/(?P<pk>[0-9]+)/$', CategoryView.as_view(), name='分类'), url(r'^tag/(?P<pk>[0-9]+)/$', TagView.as_view(), name='标签'), url(r'^blog$', BlogView.as_view(), name='博客'), url(r'^about$', AboutView.as_view(), name='关于'), url(r'^contact$', ContactView.as_view(), name='联系'), ]
# -*- coding: utf-8 -*- from django.conf.urls import url from blog.views import (IndexView, ArticleView, AllView, SearchView, ColumnView, UserView, NewsView, TagView, CategoryView, TimeLineIndexView,HeroView,StoryView,AddStoryView,AddNoteView,EditorNoteView,DeleteNoteView,CommentNoteView, CommentTestView,QueryStoryView,SearchStoryView) from django.views.generic import TemplateView, DetailView from blog.models import News from django.views.generic import RedirectView urlpatterns = [ url(r'^index$', IndexView.as_view()), url(r'^$',RedirectView.as_view(url='/story/3')), url(r'^article/(?P<slug>\w+).html$', ArticleView.as_view()), url(r'^all/$', AllView.as_view()), url(r'^search/$', SearchView.as_view()), url(r'^login/$', TemplateView.as_view(template_name="blog/login.html")), url(r'^register/$', TemplateView.as_view(template_name="blog/register.html")), url(r'^forgetpassword/$', TemplateView.as_view(template_name="blog/forgetpassword.html")), url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$', TemplateView.as_view(template_name="blog/resetpassword.html")), url(r'^column/(?P<column>\w+)$', ColumnView.as_view()), url(r'^user/(?P<slug>\w+)$', UserView.as_view()), url(r'^news/$', NewsView.as_view()), url(r'^news/(?P<pk>\w+)$', DetailView.as_view(model=News)), url(r'^tag/(?P<tag>\w+)/$', TagView.as_view()), url(r'^category/(?P<category>\w+)/$', CategoryView.as_view()),
from django.conf.urls import url from django.conf.urls.static import static from blog.views import archives,IndexView,CategoryView,DetailPostView,TagView,search from blogproject import settings app_name = 'blog' urlpatterns = [ # url(r'index/$',index,name='list'), url(r'index/$',IndexView.as_view(),name='list'), # url(r'post/(?P<pk>\d+)/$',detail,name='detail'), url(r'post/(?P<pk>\d+)/$',DetailPostView.as_view(),name='detail'), url(r'archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$',archives,name='archives'), # url(r'category/(?P<pk>\d+)/$',category,name='category'), url(r'category/(?P<pk>\d+)/$',CategoryView.as_view(),name='category'), url(r'^tag/(?P<pk>\d+)/$', TagView.as_view(), name='tag'), # url(r'^blogsearch/$',search,name='search'), ] urlpatterns += static(settings.MEDIA_URL, document_root = settings.MEDIA_ROOT)
2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin from django.urls import path from django.contrib.sitemaps import views as sitemap_views from blog.views import (IndexView, CategoryView, TagView, PostDetailView, SearchView, AuthorView) from blog.rss import LatestPostFeed from blog.sitemap import PostSitemap from config.views import LinkListView from comment.views import CommentView from .custom_site import custom_site urlpatterns = [ 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', 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('rss/', LatestPostFeed(), name='rss'), path('sitemap.xml', sitemap_views.sitemap,
2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') Including another URLconf 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 from .custom_site import custom_site from blog.views import (IndexView, CategoryView, TagView, PostDetailView, SearchView, AuthorView) from config.views import LinksView urlpatterns = [ url(r'^admin/', custom_site.urls, name='admin'), url(r'^super_admin/', admin.site.urls, name='super-admin'), 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$", PostDetailView.as_view(), name='post-detail'), # url(r"^links/$", links, name='links'), url(r"^search/$", SearchView.as_view(), name='search'), url(r"^author/(?P<owner_id>\d+$)", AuthorView.as_view(), name="author"), url(r"^links/$", LinksView.as_view(), name="links") ]
from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from blog.models import Article admin.autodiscover() from blog.views import IndexView, DetailViews, CategoryListView, TagListView urlpatterns = patterns( "", url(r"^admin/", include(admin.site.urls)), url(r"^$", IndexView.as_view(template_name="index.html")), url(r"^detail/(?P<slug>.*)$", DetailViews.as_view(model=Article, template_name="detail.html")), url(r"^category/(?P<alias>.*)/$", CategoryListView.as_view(template_name="index.html")), url(r"^tag/(?P<tag>.*)/$", TagListView.as_view(template_name="index.html")), ) urlpatterns += staticfiles_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 blog.views import ( IndexView, ArticleView, AllView, SearchView, ColumnView, UserView, NewsView, TagView, CategoryView, ) from django.views.generic import TemplateView, DetailView from blog.models import News urlpatterns = [ url(r"^$", IndexView.as_view()), url(r"^article/(?P<slug>\w+).html$", ArticleView.as_view()), url(r"^all/$", AllView.as_view()), url(r"^search/$", SearchView.as_view()), # url(r'^login/$',TemplateView.as_view(template_name="blog/login.html")), # url(r'^register/$',TemplateView.as_view(template_name="blog/register.html")), # url(r'^forgetpassword/$',TemplateView.as_view(template_name="blog/forgetpassword.html")), # url(r'^resetpassword/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>.+)/$',TemplateView.as_view(template_name="blog/resetpassword.html")), url(r"^column/(?P<column>\w+)$", ColumnView.as_view()), url(r"^user/(?P<slug>\w+)$", UserView.as_view()), url(r"^about/$", NewsView.as_view()), url(r"^news/(?P<pk>\w+)$", DetailView.as_view(model=News)), url(r"^tag/(?P<tag>\w+)/$", TagView.as_view()), url(r"^category/(?P<category>\w+)/$", CategoryView.as_view()), ]
from base.custom_site import custom_site from blog.rss import LatestPostFeed from blog.sitemap import PostSitemap from blog.views import PostDetailView, IndexView, TagView, CategoryView, SearchView, AuthorView from comment.views import CommentView from config.views import LinkView from typeidea.settings import dev urlpatterns = [ url(r'^super_admin/', admin.site.urls, name="super_admin"), url(r'^admin/', custom_site.urls, name="admin"), url(r'^post/(?P<post_id>\d+).html$', PostDetailView.as_view(), name="post_detail"), url(r'^links/$', LinkView.as_view(), name="links"), url(r"^$", IndexView.as_view(), name="index"), url(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name="tag_list"), url(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name="category_list"), url(r'^search/$', SearchView.as_view(), name="search"), url(r'^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name="author"), url(r'^comment/$', CommentView.as_view(), name="comment"), url(r'^rss|feed/', LatestPostFeed(), name="rss"), url(r'^sitemap\.xml$', sitemap_views.sitemap, {'sitemaps': { "posts": PostSitemap }}), # function based view 时的各 URL 配置 # url(r"^$", post_list, name="index"),
from django.contrib import admin from django.urls import path, re_path, include from django.views.generic import RedirectView import blog from blog.views import GrantBlogView, CompileBlogEntry, TestView, IndexView, CommentView, ReplyView from userinfo.views import RegisterView, LoginView, IsVailTokenView, UserInfoView urlpatterns = [ path('admin/', admin.site.urls), ] urlpatterns += [ path("", RedirectView.as_view(url="/blog/jz_zhou/list")), re_path(r"blog/(?P<username>\w+(-*)\w+)/(?P<data>\w+)/$", IndexView.as_view()), # path("index/<int:page>/", index), path("login/", LoginView.as_view()), path("is_login/", IsVailTokenView.as_view()), path("register/", RegisterView.as_view()), path("grant_blog/", GrantBlogView.as_view()), re_path("compile_blog/(?P<username>\w+(-*)\w+)/", CompileBlogEntry.as_view()), re_path("userinfo/(?P<username>\w+(-*)\w+)/$", UserInfoView.as_view()), re_path(r'^test/(?P<username>\w+)/$', TestView.as_view()), re_path(r"(?P<username>\w+(-*)\w+)/", include("blog.urls")), re_path(r"(?P<username>\w+(-*)\w+)/comment/(?P<article_id>\w+)/$", CommentView.as_view()), re_path(r"comment/list/(?P<article_id>\w+)/(?P<page>\w+)/$", CommentView.as_view()), re_path(r"reply_list/(?P<comment_id>\w+)/(?P<page>\w+)/$",
) from django.conf import settings from django.conf.urls.static import static from django.contrib import admin admin.autodiscover() urlpatterns = patterns( "", # Examples: # url(r'^$', 'personal.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r"^$", IndexView.as_view(), name="index"), url(r"^index.*$", IndexView.as_view(), name="index"), url(r"^about/", AboutView.as_view(), name="about"), url(r"^project/((?P<slug>[-\w]+))/(?P<id>\d+)/$", ProjectView.as_view(), name="project"), url(r"^projects/$", ProjectsView.as_view(), name="projects"), url(r"^article/(?P<id>\d+)/$", ArticleView.as_view(), name="article"), url(r"^article/(?P<slug>[-\w]+)/(?P<id>\d+)/$", ArticleView.as_view(), name="article"), url(r"^articles/$", ArticlesView.as_view(), name="articles"), url(r"^articles/(?P<slug>[-\w]+)/(?P<id>\d+)/$", ArticlesView.as_view(), name="articles"), url(r"^resources/$", ResourcesView.as_view(), name="resources"), url(r"^code_snippets/$", CodeSnippetsView.as_view(), name="code_snippets"), url(r"^publications/$", PublicationsView.as_view(), name="publications"), url(r"^admin/", include(admin.site.urls)), url(r"^grappelli/", include("grappelli.urls")), # grappelli URLS url(r"^media/(?P<path>.*)$", "django.views.static.serve", {"document_root": settings.MEDIA_ROOT}), # url(r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT, 'show_indexes': True}),
from config.views import LinkListView from comment.views import CommentView from django.contrib.sitemaps import views as sitemap_views from blog.rss import LatestPostFeed from blog.sitemap import PostSitemap urlpatterns = [ # 增加name属性,通过name解析成URL # url('^$', post_list, name='index'), # function view # url('^category/(?P<category_id>\d+)/$', post_list, name='category-list'), # url('^tag/(?P<tag_id>\d+)/$', post_list, name='tag-list'), # url('^post/(?P<post_id>\d+).html$', post_detail, name='post-detail'), # url('^links/$', links, name='links'), url('^$', IndexView.as_view(), name='index'), # class-base view url('^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name='category-list'), url('^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name='tag-list'), url('^post/(?P<post_id>\d+).html$', PostDetailView.as_view(), name='post-detail'), url('^search/$', SearchView.as_view(), name='search'), url('^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name='author'), url('^links/$', LinkListView.as_view(), name='links'), url('^comment/$', CommentView.as_view(), name='comment'), # path('super_admin/', admin.site.urls), # 管理用户后台 # path('admin/', custom_site.urls), # 管理业务后台 url('^super_admin/', admin.site.urls, name='super-admin'),
from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.views.generic import TemplateView from django.conf.urls.static import static from blog.views import IndexView, AboutView, ContactView, ProjectListView, ProjectDetailView # registering admin admin.autodiscover() urlpatterns = [ url(r"^$", IndexView.as_view(), name="home"), # url(r'^ajax-upload/', include('startproject.cicu.urls')), url(r"^blog/", include("blog.urls", namespace="blog", app_name="blog")), url(r'^admin/', include(admin.site.urls)), url(r'^uploads/(?P<path>.*)$', 'django.views.static.serve', { 'document_root': settings.MEDIA_ROOT, 'show_indexes': True }), url(r"^about/$", AboutView.as_view(), name="about"), url(r"^contact/$", ContactView.as_view(), name="contact"), url(r"^markdown/", include("django_markdown.urls")), url(r"^projects/$", ProjectListView.as_view(), name="project"), url(r"^projects/(?P<slug>[\w-]+)/$", ProjectDetailView.as_view(), name="projectdetail"), url(r'contact/thanks/$', TemplateView.as_view(template_name='thanks.html')), ]
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.contrib import admin from django.urls import path,re_path,include from user.views import pcgetcaptcha from blog.views import UpLoadView,IndexView from Xadmin.service import Xadmin urlpatterns = [ path('admin/', admin.site.urls), re_path('^Xadmin/', Xadmin.site.urls), re_path(r"^user/",include("user.urls",namespace="user")), re_path(r"^blog/",include("blog.urls",namespace="blog")), re_path(r'^pc-geetest/register',pcgetcaptcha), re_path(r'^upload/',UpLoadView.as_view(),name="upload"), re_path(r'^tinymce/', include('tinymce.urls')), # 富文本编辑器 re_path(r"^$", IndexView.as_view(), name="index"), ]
https://docs.djangoproject.com/en/1.11/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. Import the include() function: from django.conf.urls import url, include 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) """ from __future__ import unicode_literals from django.conf.urls import url from django.contrib import admin from .custom_site import custom_site # from blog.views import post_list,post_detail from blog.views import IndexView, CategoryView, TagView, PostView #from config.views import links 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'^links/$',links), url(r'^admin/', admin.site.urls), url(r'^cus_admin/', custom_site.urls) ]
from blog.views import IndexView, CategoryView, TagView, PostDetailView, SearchView, AuthorView, MyPostsView from config.views import LinkListView from .custom_site import custom_site from comment.views import CommentView from blog.rss import LatestPostFeed from blog.sitemap import PostSitemap from blog.apis import PostViewSet, CategoryViewSet, TagViewSet routers = DefaultRouter() routers.register('post', PostViewSet, basename='api-post') routers.register('category', CategoryViewSet, basename='api-category') routers.register('tag', TagViewSet, basename='api-tag') urlpatterns = [ path('', IndexView.as_view(), name="index"), path('myposts/', MyPostsView.as_view(), name="my_posts"), path('post/<int:post_id>.html', PostDetailView.as_view(), name="post_detail"), path('category/<int:category_id>', CategoryView.as_view(), name="category_list"), path('tag/<int:tag_id>', TagView.as_view(), name="tag_list"), path('links/', LinkListView.as_view(), name="links"), path('search/<int:type_id>', SearchView.as_view(), name='search'), path('author/<int:author_id>', AuthorView.as_view(), name='author'), path('comment/', CommentView.as_view(), name='comment'), path('ckeditor/', include('ckeditor_uploader.urls')), path('rss/', LatestPostFeed(), name='rss'), path('sitemap.xml/',
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, 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 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 patterns, include, url from django.contrib import admin from blog.views import IndexView, EntryDetailView urlpatterns = patterns( '', # Examples: # url(r'^$', 'blog20min.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^markdown/', include('django_markdown.urls')), url(r'^$', IndexView.as_view()), url(r'^entry/(?P<slug>[-\w]+)/$', EntryDetailView.as_view()), )
# from config.views import links #xversion.register_models() #xadmin.autodiscover() router = routers.DefaultRouter() router.register(r'posts', PostViewSet) router.register(r'cats', CategoryViewSet) router.register(r'tags', TagViewSet) router.register(r'users', UserViewSet) #def static(prefix, view=serve, **kwargs): # return [path(r'^%s(?P<path>.*)$' % re.escape(prefix.lstrip('/')), view, kwargs=kwargs)] urlpatterns = [ path('', cache_page(60)(IndexView.as_view()), name="index"), path('category/<str:category_name>/', CategoryView.as_view(), name='category'), path('tag/<int:tag_id>/', TagView.as_view(), name='tag'), path('post/<slug:slug>/', PostView.as_view(), name='detail'), path('author/<str:author_username>/', AuthorView.as_view(), name='author'), path('links/', LinkView.as_view(), name='links'), path('admin/', admin.site.urls), path('comment/', CommentView.as_view(), name="Comment"), path('ckeditor/', include('ckeditor_uploader.urls')), path('api/', include(router.urls)), path('api/docs/', documentation.include_docs_urls(title='blogsys apis')), ] + static(settings.MEDIA_URL, serve, document_root=settings.MEDIA_ROOT) + static( settings.STATIC_URL, serve, document_root=settings.STATIC_ROOT)
router.register(r'posts', PostViewSet) accounts_router = routers.NestedSimpleRouter( router, r'accounts', lookup='account' ) accounts_router.register(r'posts', AccountPostsViewSet) urlpatterns = patterns('', # Examples: # url(r'^$', 'blog.views.home', name='home'), # url(r'^blog/', include('blog.urls')), # url(r'^api/v1/', include(router.urls)), # url(r'^api/v1/', include(accounts_router.urls)), # url(r'^api/v1/auth/login/$', LoginView.as_view(), name='login'), # url(r'^api/v1/auth/logout/$', LogoutView.as_view(), name='logout'), # url(r'^.*$', IndexView.as_view(), name='index'), url(r'^admin/', include(admin.site.urls)), url(r'^api/v1/', include(router.urls)), url(r'^api/v1/', include(accounts_router.urls)), url(r'^api/v1/auth/login/$', LoginView.as_view(), name='login'), url(r'^api/v1/auth/logout/$', LogoutView.as_view(), name='logout'), url('^.*$', IndexView.as_view(), name='index'), )
from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib.sitemaps import views as sitemap_views from django.views.decorators.cache import cache_page import xadmin xadmin.autodiscover() from blog.views import (IndexView, CategoryListView, TagsListView, PostDetailView, PageDetailView) from feeds import LatestEntriesFeed from sitemap import PostSitemap urlpatterns = patterns( '', url(r'^$', IndexView.as_view(), name='home'), url(r'^ueditor/', include('DjangoUeditor.urls')), url(r'^feed|rss/$', LatestEntriesFeed()), url(r'^sitemap\.xml$', cache_page(60 * 60 * 12)(sitemap_views.sitemap), {'sitemaps': { 'posts': PostSitemap }}), url(r'^category/(?P<alias>\w+)/', CategoryListView.as_view()), url(r'^tag/(?P<tag>[\w|\.|\-]+)/$', TagsListView.as_view()), url(r'^xadmin/', include(xadmin.site.urls), name='xadmin'), url(r'^xmlrpc/$', 'django_xmlrpc.views.handle_xmlrpc', {}, 'xmlrpc'), #放到最后 url(r'^(?P<slug>[\w|\-|\d|\W]+?).html$', PostDetailView.as_view()), url(r'^(?P<slug>\w+)/$', PageDetailView.as_view()),
from django.conf.urls import url from blog.views import IndexView, StoriesView, StoryView, ArticleView, ArticleView urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), ]
from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from blog.models import Article admin.autodiscover() from blog.views import (IndexView, DetailViews, CategoryListView, TagListView) urlpatterns = patterns( '', url(r'^admin/', include(admin.site.urls)), url(r'^$', IndexView.as_view(template_name='index.html')), url(r'^detail/(?P<slug>.*)$', DetailViews.as_view(model=Article, template_name='detail.html')), url(r'^category/(?P<alias>.*)/$', CategoryListView.as_view(template_name='index.html')), url(r'^tag/(?P<tag>.*)/$', TagListView.as_view(template_name='index.html')), ) urlpatterns += staticfiles_urlpatterns()
from django.conf.urls import patterns, include, url from django.contrib import admin from blog.views import IndexView,CategoryView,TagsView,ShowPost from blog.feeds import LatestPostsFeed admin.autodiscover() urlpatterns = patterns('', url(r'^feed/latest/?(?P<count>[0-9]+)?/$',LatestPostsFeed(),name="feed"), url(r'^admin/', include(admin.site.urls)), url(r'^$',IndexView.as_view(), name='home'), url(r'^tag/(?P<tagslug>[-\w]+)/$',TagsView.as_view(),name='showtag'), url(r'^(?P<slug>[-\w]+)/$',CategoryView.as_view(),name='showcategory'), url(r'^(?P<catslug>[-\w]+)/(?P<postslug>[-\w]+)/$',ShowPost.as_view(),name='showpost'), url(r'^tinymce/', include('tinymce.urls')), )
from django.urls import path from blog.views import (IndexView, PostDetailView, CategoryListView, TagListView, CategoryPostView, TagPostView, SearchPostView) app_name = 'blog' urlpatterns = [ path('', IndexView.as_view(), name='root'), path('post/<int:pk>/', PostDetailView.as_view(), name='post_detail'), path('categories/', CategoryListView.as_view(), name='category_list'), path('tags/', TagListView.as_view(), name='tag_list'), path('category/<str:category_slug>/', CategoryPostView.as_view(), name='category_post'), path('tag/<str:tag_slug>/', TagPostView.as_view(), name='tag_post'), path('search/', SearchPostView.as_view(), name='search_post'), ]
from django.conf.urls import patterns, include, url from django.contrib import admin from blog.views import IndexView, EntradaDetailView from django.conf import settings urlpatterns = patterns('', # Examples: # url(r'^$', 'dblog.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^markdown/', include('django_markdown.urls')), url(r'^$', IndexView.as_view(), name="index"), url(r'^entrada/(?P<slug>[-\w]+)/$', EntradaDetailView.as_view()), url('', include('social.apps.django_app.urls', namespace='social')), url(r'^salir/$', 'blog.views.Logout'), )
from django.conf.urls import patterns, include, url from django.contrib import admin from blog.views import IndexView from blog.views import AddBlogView urlpatterns = patterns('blog.views', # Examples: # url(r'^$', 'simple_blog.views.home', name='home'), # url(r'^blog/', include('blog.urls')), url(r'^$', IndexView.as_view(template_name = 'blog/index.html'), name = 'index'), url(r'^(?P<page_size>[0-9]+)/(?P<page>[0-9]+)/$', IndexView.as_view(template_name = 'blog/index.html'), name = 'index_by_page'), url(r'^ueditorcontroller', 'ueditorcontroller', name = 'ueditorcontroller'), url(r'^dashboard/$', 'dashboard', name = 'dashboard'), url(r'^add_blog$', 'add_blog' , name = 'add_blog'), url(r'^(?P<slug>[a-z0-9-]+)/$', 'show_blog', name = 'show_blog_by_slug'), url(r'^(?P<id>[0-9]+)/$', 'show_blog', name = 'show_blog_by_id'), url(r'^tag/(?P<tag>[\w]+)/$', 'show_blog', name='show_blog_by_tag'), url(r'^category/(?P<category>[\w]+)/$', 'show_blog', name='show_blog_by_category'), url(r'^add_blog_class$', AddBlogView.as_view(), name = 'add_blog_view') )