示例#1
0
文件: urls.py 项目: Mark-Jordan/blog
from .sitemap import PostSitemap
from main.apis import post_list,PostList,PostViewSet,CategoryViewSet

router=DefaultRouter()
router.register(r'post',PostViewSet,base_name='api-post')
router.register(r'category',CategoryViewSet,base_name='api-category')

urlpatterns = [
    url(r'^$',IndexView.as_view(),name='index'),
    url(r'^author/(?P<author_id>\d+)',AuthorView.as_view(),name='author'),
    url(r'^search/$',SearchView.as_view(),name='search'),
    url(r'^comment/$',CommentView.as_view(),name="comment"),
    url(r'^category/(?P<category_id>\d+)$',CategoryView.as_view(),name='category_list'),
    url(r'^tag/(?P<tag_id>\d+)$',TagView.as_view(),name='tag_list'),
    url(r'^post/(?P<post_id>\d+).html$',PostDetailView.as_view(),name='post_detail'),
    url(r'^links$',LinkView.as_view(),name='links'),
    url(r'^rss/',LatestPostFeed(),name='rss'),
    url(r'^sitemap\.xml$',sitemap,{'sitemaps':{'posts':PostSitemap}},
        name='django.contrib.sitemaps.views.sitemap'),
    url(r'^category-autocomplete/$',CategoryAutocomplete.as_view(),name='category-autocomplete'),
    url(r'^tag-autocomplete/$',TagAutocomplete.as_view(),name='tag-autocomplete'),
    url(r'^ckeditor/',include('ckeditor_uploader.urls')),
    url(r'^admin/', xadmin.site.urls,name='main_admin'),
    url(r'^super_admin/', permission_site.urls,name='super_admin'),
    url(r'^api/post_list/',post_list,name='post-list'),
    url(r'^api/postList/',PostList.as_view(),name='PostList'),
    url(r'^api/',include(router.urls,namespace='api')),
    url(r'^api/docs/',include_docs_urls(title='blog api')),
] + static(settings.MEDIA_URL,document_root=settings.MEDIA_ROOT)

示例#2
0
    return [
        url(r'^%s(?P<path>.*)$' % re.escape(prefix.lstrip('/')),
            serve,
            kwargs=kwargs)
    ]


urlpatterns = [
    url(r'^$', IndexView.as_view(), name="index"),
    url(r'^category/(?P<category_id>\d+)/',
        cache_page(60 * 10)(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'ckeditor/', include('ckeditor_uploader.urls')),
    url(r'^api/docs/', include_docs_urls(title='blogproject apis')),
    url(r'^api/', include(router.urls)),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.DEBUG:
    import debug_toolbar
示例#3
0
# from blog.views import post_list, post_detail
# from blog.views import PostList, PostDetail
from blog.views import IndexView, SearchView, AuthorView, CategoryView, TagView, PostDetailView
from config.views import LinkView
from comment.views import CommentView

from blog.rss import LatestPostFeed

urlpatterns = [
    # path('admin/', admin.site.urls),
    path('superadmin/', admin.site.urls, name='super-admin'),
    path('admin/', custom_site.urls, name='admin'),

    # path('', post_list, name='index'),
    path('', IndexView.as_view(), name='index'),
    path('search/', SearchView.as_view(), name='search'),
    re_path('^author/(?P<owner_id>\d+)/$', AuthorView.as_view(),
            name='author'),
    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'),
    path('links/', LinkView.as_view(), name='links'),
    path('comment/', CommentView.as_view(), name='comment'),
    path('rss/', LatestPostFeed(), name='rss'),
]
示例#4
0
    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'))
"""
import xadmin
xadmin.autodiscover()
from xadmin.plugins import xversion
from django.conf.urls import url
from django.contrib import admin

from comment.views import CommentView
from blog.views import PostDetailView, IndexView, TagView, CategoryView
from config.views import LinkView
from typeidea import adminx

urlpatterns = [
    url(r'^$', IndexView.as_view(), name='index'),
    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'^post/(?P<post_id>\d+)/$', PostDetailView.as_view(), name='detail'),
    url(r'^admin/', xadmin.site.urls),
    url(r'^links/', LinkView.as_view(), name='link'),
    url(r'^comment/', CommentView.as_view(), name='comment'),
]