Пример #1
0
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.i18n import i18n_patterns
from django.conf.urls.static import static
from django.contrib import admin
from django.contrib.flatpages.views import flatpage
from django.urls import path, re_path, include

from blog.views import BlogIndexView
from pages.views import HomePage, OurTeamView

urlpatterns = [
    path("admin/", admin.site.urls),
    path("i18n/", include("django.conf.urls.i18n")),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

urlpatterns += i18n_patterns(
    path("blog/", BlogIndexView.as_view(), name="blog_index"),
    path("our-team/", OurTeamView.as_view(), name="our-team"),
    path("", HomePage.as_view(), name="home"),
    re_path(r"^(?P<url>.*/)$", flatpage),
    prefix_default_language=False,
)

if settings.DEBUG:
    import debug_toolbar  # noqa

    urlpatterns = [path("__debug__/", include(debug_toolbar.urls))
                   ] + urlpatterns
Пример #2
0
"""

from django.conf.urls import url, include
from django.contrib import admin
from django.views import static

from blog.views import BlogIndexView
from django.conf import settings

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    # 上传部件自动调用上传地址
    url(r'^ckeditor/', include("ckeditor_uploader.urls")),
    # 全文搜索框架
    url(r'^search/', include('haystack.urls', namespace='search')),
    # 绑定子路由的路由
    url(r'^user/', include("user.urls", namespace='user')),
    url(r'^blog/', include("blog.urls", namespace='blog')),
    url(r'^comments/', include("comments.urls", namespace='comments')),

    # 绑定博客首页的路由
    url(r"^$", BlogIndexView.as_view()),
    url(r'^static/(?P<path>.*)$',
        static.serve, {'document_root': settings.STATIC_ROOT},
        name='static'),
]

handler404 = "blog.views.page_not_found"
handler500 = "blog.views.page_error"
handler403 = "blog.views.permission_denied"
Пример #3
0
from django.urls import path, re_path
from django.contrib.sitemaps.views import sitemap

from blog.sitemaps import BlogSitemap
from blog.views import (
    BlogDetailView,
    BlogIndexView,
    BlogPostsRssFeed,
    BlogPostsAtomFeed,
)

urlpatterns = [
    # blog urls
    path("", BlogIndexView.as_view(), name="blog"),
    re_path(r"^(?P<slug>[-\w]+)/$",
            BlogDetailView.as_view(),
            name="blog_detail"),
    # rss & atom feed
    path("feed/rss/", BlogPostsRssFeed(), name="blog_rss_feed"),
    path("feed/atom/", BlogPostsAtomFeed(), name="blog_atom_feed"),
    # sitemap
    re_path(
        r"^sitemap\.xml$",
        sitemap,
        {"sitemaps": {
            "blog": BlogSitemap()
        }},
        name="blog_sitemap",
    ),
]
Пример #4
0
from django.conf.urls import patterns, url
from django.views.generic.base import RedirectView
from blog.sitemaps import BlogSitemap

from blog.views import BlogIndexView, BlogDetailView, \
     BlogPostsAtomFeed, BlogPostsRssFeed, TagDetailView, BlogSearchView, LegacyPostRedirectView

urlpatterns = patterns(
    '',

    # blog urls
    url(r'^$', BlogIndexView.as_view(), name="blog"),
    url(r'^search$', BlogSearchView.as_view(), name="blog_search"),
    url(r'^post/(?P<slug>[-\w]+)/$',
        BlogDetailView.as_view(),
        name="blog_detail"),
    url(r'^tag/(?P<slug>[-\w]+)/$',
        TagDetailView.as_view(),
        name="blog_tag_detail"),

    # rss & atom feed
    url(r'^feed/rss$', BlogPostsRssFeed(), name="blog_rss_feed"),
    url(r'^feed/atom', BlogPostsAtomFeed(), name="blog_atom_feed"),

    # sitemap
    url(r'^sitemap\.xml$',
        'django.contrib.sitemaps.views.sitemap',
        {'sitemaps': dict(blog=BlogSitemap())},
        name="blog_sitemap"),

    # legacy urls for oldest tumblr blog.
Пример #5
0
# coding:utf8

from django.conf.urls import url
from blog.views import BlogIndexView, BlogDetailView, BlogDetailAdminView, DateBasePostDetailView

urlpatterns = [
	url(r'^$', BlogIndexView.as_view(), name="index"),
	url(r'^(?P<post_pk>\d+)/$', BlogDetailView.as_view(), name="blog_post_pk"),
	url(r'^(?P<post_secret_key>\w+)/$', BlogDetailAdminView.as_view(), name="blog_post_secret"),
]

urlpatterns += [
	url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
		DateBasePostDetailView.as_view(), name="blog_post"),
]
Пример #6
0
from django.conf.urls import patterns, url
from blog.models import Post
from blog.views import BlogIndexView

urlpatterns = patterns(
    '',
    url(r'^$',
        BlogIndexView.as_view(model=Post, paginate_by=5, date_field='date')),
    url(r'^(?P<slug>[a-zA-Z0-9-]+)', 'blog.views.view_post'),
)
Пример #7
0
from django.conf.urls import patterns, url
from django.views.generic.base import RedirectView
from blog.sitemaps import BlogSitemap

from blog.views import BlogIndexView, BlogDetailView, \
     BlogPostsAtomFeed, BlogPostsRssFeed, TagDetailView, BlogSearchView, LegacyPostRedirectView


urlpatterns = patterns('',

    # blog urls
    url(r'^$', BlogIndexView.as_view(), name="blog"),
    url(r'^search$', BlogSearchView.as_view(), name="blog_search"),
    url(r'^post/(?P<slug>[-\w]+)/$',
        BlogDetailView.as_view(), name="blog_detail"),
    url(r'^tag/(?P<slug>[-\w]+)/$',
        TagDetailView.as_view(), name="blog_tag_detail"),

    # rss & atom feed
    url(r'^feed/rss$', BlogPostsRssFeed(), name="blog_rss_feed"),
    url(r'^feed/atom', BlogPostsAtomFeed(), name="blog_atom_feed"),

    # sitemap
    url(r'^sitemap\.xml$', 'django.contrib.sitemaps.views.sitemap', {'sitemaps': dict(
        blog=BlogSitemap()
    )}, name="blog_sitemap"),

    # legacy urls for oldest tumblr blog.
    url(r'^post/(?P<legacy_post_id>\d+)',
        LegacyPostRedirectView.as_view(), name="legacy_blog_detail"),
    url(r'^tagged/(?P<slug>[-\w]+)', RedirectView.as_view(
Пример #8
0
from django.conf.urls import patterns, url
from blog.models import Post
from blog.views import BlogIndexView

urlpatterns = patterns('',
    url(r'^$', BlogIndexView.as_view(
        model=Post,
        paginate_by=5,
        date_field='date')),
    url(r'^(?P<slug>[a-zA-Z0-9-]+)', 'blog.views.view_post'),
)
Пример #9
0
# Events
urlpatterns += [
    url(r'^events/$', events.dashboard_view, name='event-dashboard'),
    url(r'^events/cubs/$',
        TemplateView.as_view(template_name='events/cubs.html'),
        name='cubs-tickets'),
    url(r'^events/list/$', events.list_view, name='event-list'),
    url(r'^events/create/$', events.create_view, name='event-create'),
    url(r'^events/(?P<slug>[-\w]+)/$', events.detail_view,
        name='event-detail'),
    url(r'^events/(?P<slug>[-\w]+)/edit/$',
        events.edit_view,
        name='event-edit'),
    url(r'^locations/create/$', locations.create_view, name='location-create'),
    url(r'^speaker/(?P<slug>[-\w]+)/$',
        speakers.detail_view,
        name='speaker-detail'),
    url(r'^dues/$', dues.pay_dues, name='dues'),
    url(r'^(?P<slug>[-\w]+)/rsvp/$', events.rsvp_view, name='rsvp'),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

urlpatterns += [
    url(r'^pages/$', BlogIndexView.as_view(), name='blog'),
]

# API
urlpatterns += [
    url(r'^api/', include(router.urls, namespace='api')),
]
Пример #10
0
    # url(r'^$',post_list),
    # url(r'^category/(?P<category_id>\d+)/$',post_list),
    # url(r'tag/(?P<tag_id>\d+)/$',post_list),
    # url(r'^post/(?P<post_id>\d+).html$',post_detail),
    # url(r'^links/$',links),
    # url(r'^admin/', custom_site.urls),
    # url(r'^super_admin/', admin.site.urls),
    # url(r'^$',IndexView.as_view(),name='newIndex'),  #项目的总index,旧版
    url(r'^$', IndexViewHome.as_view(), name='IndexHome'),  #项目的总index,新版
    url(r'^index_blog/', IndexViewBlog.as_view(),
        name='IndexBlog'),  #项目的总index
    url(r'^index_gallery/', IndexViewGallery.as_view(),
        name='IndexGallery'),  #项目的总index
    url(r'^index_aca/', IndexViewAca.as_view(), name='IndexAca'),  #项目的总index
    url(r'^blogindex/', BlogIndexView.as_view(), name='blog-view'),  # 博客首页
    url(r'^about/', aboumeView.as_view(), name='aboutme'),  #关于我
    url(r'^aboutsite/', abousiteView.as_view(), name='aboutsite'),  #关于我
    url(r'^acaindex/', acaindexView.as_view(), name='academic-view'),  #学术首页
    url(r'^gallery/', galleryView.as_view(), name='gallery-view'),  #画廊首页

    #学术部分
    url(r'^acaCT/', acaCTView.as_view(), name='academic-CT'),

    #博客部分
    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'^postdetail/(?P<post_id>\d+).html/$',
        PostDetailView.as_view(),
Пример #11
0
# coding:utf8

from django.conf.urls import url
from blog.views import BlogIndexView, BlogDetailView, BlogDetailAdminView, DateBasePostDetailView

urlpatterns = [
    url(r'^$', BlogIndexView.as_view(), name="index"),
    url(r'^(?P<post_pk>\d+)/$', BlogDetailView.as_view(), name="blog_post_pk"),
    url(r'^(?P<post_secret_key>\w+)/$',
        BlogDetailAdminView.as_view(),
        name="blog_post_secret"),
]

urlpatterns += [
    url(r'^(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d{2})/(?P<slug>[-\w]+)/$',
        DateBasePostDetailView.as_view(),
        name="blog_post"),
]