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.conf.urls import url from blog.views import IndexView, StoriesView, StoryView, ArticleView, ArticleView urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), ]
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 re_path, include from django.contrib.sitemaps import views as sitemap_views 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'),
from django.conf import settings urlpatterns = [ url(r'^i18n/', include('django.conf.urls.i18n')), # The Django admin is not officially supported; expect breakage. # Nonetheless, it's often useful for debugging. url(r'^checkout/paypal/', include('paypal.express.urls')), # Optional #url(r'^dashboard/paypal/express/', application.urls), url(r'^super_admin/', include(admin.site.urls)), url(r'^admin/', include(custom_site.urls)), url(r'^contact/', include('contact.urls')), 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'^blog/$', IndexView.as_view(), name='blog'), url(r'^blog/about/$', TemplateView.as_view(template_name="blog/about.html")), url(r'^links/$', LinkView.as_view(), name='links'), url(r'^blog/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'^ckeditor/', include('ckeditor_uploader.urls')), url(r'', include(application.urls)), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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 IndexView, NewCommentView, NewPostView, PostView urlpatterns = [ path('posts', IndexView.as_view(), name='blog-index'), path('posts/<int:pk>', PostView.as_view(), name='blog-post'), path('posts/new', NewPostView.as_view(), name='blog-new-post'), path('comment/new', NewCommentView.as_view(), name='blog-new-comment'), ]
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)
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"), ]
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 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 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 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"), )
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 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()), ]
PostDetailView, SearchView) from blog.rss import LatestPostFeed from blog.sitemap import PostSitemap from .custom_site import custom_site from config.views import LinkListView from comment.views import CommentView from rest_framework.routers import DefaultRouter from rest_framework.documentation import include_docs_urls router = DefaultRouter() router.register(r'post', PostViewSet, basename="api-post") router.register(r'category', CategoryViewSet, basename="api-category") urlpatterns = [ path('', IndexView.as_view(), name="homepage"), 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'),
# 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)
from django.conf.urls import url, include from blog.views import IndexView, DetailView, ToTestMarkdownxView, WriteArticlePageView, WriteArticleView, MainIndexView urlpatterns = [ url(r'^main/$', MainIndexView.as_view(), name='blog_main'), url(r'^index/$', IndexView.as_view(), name='blog_index'), url(r'^detail/(?P<article_id>\d+)/$', DetailView.as_view(), name='article_detail'), url(r'^test_markdown/$', ToTestMarkdownxView.as_view(), name='blog_test_markdown'), url(r'^get_articlepage/$', WriteArticlePageView.as_view(), name='get_articlepage'), url(r'^add_article/$', WriteArticleView.as_view(), name='add_article'), ]
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()
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 post_list, post_detail from config.views import links from blog.views import PostDetailView from blog.views import (IndexView, CategoryView, TagView, PostDetailView) urlpatterns = [ # url(r"^$",post_list,name="tag_list"), url(r"^$", IndexView.as_view(), name="index"), # url(r"^category/(?P<category_id>\d+)/$",post_list,name="category_list"), url(r"^category/(?P<category_id>\d+)/$", CategoryView.as_view(), name="category_list"), # url(r"^tag/(?P<tag_id>\d+)/$",post_list,name="tag_list"), url(r"^tag/(?P<tag_id>\d+)/$", TagView.as_view(), name="tag_list"), # url(r"^post/(?P<post_id>\d+).html/$",post_detail,name="post_detail"), url(r"^post/(?P<pk>\d+).html/$", PostDetailView.as_view(), name="post_detail"), url(r"^links/$", links, name="links"), url(r'^admin/', admin.site.urls, name="admin"), url(r'^super_admin/', custom_site.urls, name="super_admin"), ]
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'), ]
# -*- 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.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 .custom_site import custom_site from blog.apis import PostViewSet, CategoryViewSet from blog.views import (IndexView, CategoryView, TagView, PostDetailView, SearchView, AuthorView) from blog.rss import LatestPostFeed from blog.sitemap import PostSitemap from comment.views import CommentView from config.views import LinkListView router = DefaultRouter() router.register(r'post', PostViewSet, basename='api-post') router.register(r'category', CategoryViewSet, basename='api-category') urlpatterns = [ re_path(r'^$', IndexView.as_view(), name="index"), re_path(r'^links/$', LinkListView.as_view(), name="links"), re_path( r'^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name="author"), re_path(r'^search/$', SearchView.as_view(), name="search"), re_path(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name="category-list"), re_path(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name="tag-list"), re_path(r'^post/(?P<post_id>\d+)/$', PostDetailView.as_view(), name="post-detail"), re_path(r'^comment/$', CommentView.as_view(), name="comment"), re_path(r'^rss|feed/$', LatestPostFeed(), name="rss"), re_path(r'^sitemap\.xml$', sitemap_views.sitemap, {'sitemaps': {
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 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 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 .custom_site import custom_site from .autocomplete import CategoryAutocompleteView, TagAutocompleteView router = DefaultRouter() router.register(r'post', PostViewSet, basename='api-post') router.register(r'category', CategoryViewSet, basename='api-category') urlpatterns = [ path('super_admin/', admin.site.urls, name='super-admin'), path('admin/', custom_site.urls, name='admin'), path('xadmin/', xadmin.site.urls, name='xadmin'), path('ckeditor/', include('ckeditor_uploader.urls')), path('api/', include(router.urls)), path('api/docs/', include_docs_urls(title='typeidea apis')), re_path(r'^$', cache_page(60 * 20, key_prefix='sitemap_cache_')(IndexView.as_view()), name='index'), re_path(r'^category/(?P<category_id>\d+)/$', CategoryView.as_view(), name='category-list'), re_path(r'^tag/(?P<tag_id>\d+)/$', TagView.as_view(), name='tag-list'), re_path(r'^post/(?P<post_id>\d+)/$', PostDetailView.as_view(), name='post-detail'), re_path(r'^links/$', LinkListView.as_view(), name='links'), re_path(r'^comment/$', CommentView.as_view(), name='comment'), re_path(r'^search/$', SearchView.as_view(), name='search'), re_path(r'^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name='author'), re_path(r'^rss|feed$', LatestPostFeed(), name='rss'), re_path(r'^sitemap\.xml$', cache_page(60 * 20, key_prefix='sitemap_cache_')(sitemap_views.sitemap), {'sitemaps': {'posts': PostSiteMap}}), re_path(r'^category-autocomplete/$', CategoryAutocompleteView.as_view(), name='category-autocomplete'), re_path(r'^tag-autocomplete/$', TagAutocompleteView.as_view(), name='tag-autocomplete'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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 django.contrib import admin from django.conf import settings from django.conf.urls.static import static from blog.views import IndexView, ArticleDetailView, CategoryView, CommentCreateView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^comment/create/$', CommentCreateView.as_view(), name="comment-create"), url(r'^categorie/(?P<slug>[-\w]+)/$', CategoryView.as_view(), name='category'), url(r'^article/(?P<slug>[-\w]+)/$', ArticleDetailView.as_view(), name='article-detail'), url(r'^$', IndexView.as_view(), name="index"), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
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 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.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 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()), ]
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(),
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'), )
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 blog.views import (IndexView, CategoryView, TagView, PostDetailView, SearchView) from config.views import links from .custom_site import custom_site urlpatterns = [ path('super_admin/', admin.site.urls, name="super-admin"), path('admin/', custom_site.urls, name="admin"), 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("links", links, name="links"), path("search/", SearchView.as_view(), name='search') ]
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 from blog.apis import PostViewSet, CategoryViewSet router = DefaultRouter() router.register(r'post', PostViewSet, basename='api-post') router.register(r'category', CategoryViewSet, basename='api-category'), urlpatterns = [ path('', IndexView.as_view(), name='index'), # path('', custom_site.urls, name='index'), path('blog/', IndexView.as_view(), name='blog'), 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'^search/$', SearchView.as_view(), name='search'), url(r'^comment/$', CommentView.as_view(), name='comment'), url(r'^author/(?P<owner_id>\d+)/$', AuthorView.as_view(), name='author'), url(r'^post/(?P<post_id>\d+).html$', PostDetailView.as_view(), name='post-detail'), url(r'^links/$', LinkListView.as_view(), name='links'), path('super_admin/', admin.site.urls, name='super-admin'), path('admin/', custom_site.urls, name='admin'),
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 url from blog.views import IndexView, ArticleView, AboutView, AllView, DownView, SearchView, ColumnView, UserView, TagView, CategoryView from django.views.generic import TemplateView, DetailView 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'^tag/(?P<tag>\w+)/$', TagView.as_view()), url(r'^category/(?P<category>\w+)/$', CategoryView.as_view()), url(r'^about/$', AboutView.as_view()), url(r'^down/$', DownView.as_view()), ]
from django.contrib import admin from django.urls import path, include from blog.views import IndexView, CategoryIndexView, BlogDetailView, ContactFormView, PostModelFormView, PostFormUpdateView, PostDeleteView urlpatterns = [ path('', IndexView.as_view()), path('contactus', ContactFormView.as_view(), name='contact-us'), path('posts', PostModelFormView.as_view(), name='new-post'), path('posts/<slug:slug>', PostFormUpdateView.as_view(), name='update-post'), path('<slug:slug>', BlogDetailView.as_view(), name='post-detail'), path('delete/<slug:slug>', PostDeleteView.as_view(), name='delete-post'), ]
from django.urls import path from django.views.decorators.http import require_POST from blog.views import IndexView, PostDetailView, PostCreateView, PostEditView, PostDeleteView, post_like, \ ProfilePageView urlpatterns = [ path('', IndexView.as_view(), name='index'), path('post/<int:pk>', PostDetailView.as_view(), name='full post'), path('post/create/', PostCreateView.as_view(), name='create post'), path('post/edit/<int:pk>', PostEditView.as_view(), name='edit post'), path('post/delete/<int:pk>', PostDeleteView.as_view(), name='delete post'), path('post/like/<int:pk>', post_like, name='like post'), path('profile/<int:pk>', ProfilePageView.as_view(), name='profile page'), ]
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') )