Example #1
0
#!/usr/bin/python3
# -*- coding:utf-8 -*-
# __author__ = '__Jack__'

from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
from django.views import defaults as default_views

from zanhu.news.views import NewsListView

urlpatterns = [
    path('', NewsListView.as_view(), name='home'),

    # 用户管理
    path('users/', include('users.urls', namespace='users')),
    path('accounts/', include('allauth.urls')),

    # 第三方应用
    path('markdownx/', include('markdownx.urls')),
    path('comments/', include('django_comments.urls')),
    path('search/', include('haystack.urls')),

    # 开发的应用
    path('news/', include('news.urls', namespace='news')),
    path('articles/', include('articles.urls', namespace='articles')),
    path('qa/', include('qa.urls', namespace='qa')),
    path('messages/', include('messager.urls', namespace='messages')),
    path('notifications/',
         include('notifications.urls', namespace='notifications')),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Example #2
0
from django.conf import settings
from django.urls import include, path
from django.conf.urls.static import static
# from django.contrib import admin
from django.views.generic import TemplateView
from django.views import defaults as default_views

from zanhu.news.views import NewsListView

urlpatterns = [
    path('', NewsListView.as_view(), name="home"),

    # 用户管理
    path("users/", include("zanhu.users.urls", namespace="users")),
    path("accounts/", include("allauth.urls")),

    # 开发的应用
    path("news/", include("zanhu.news.urls", namespace="news")),
    path("articles/", include("zanhu.articles.urls", namespace="articles")),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

if settings.DEBUG:
    # This allows the error pages to be debugged during development, just visit
    # these url in browser to see how these error pages look like.
    urlpatterns += [
        path(
            "400/",
            default_views.bad_request,
            kwargs={"exception": Exception("Bad Request!")},
        ),
        path(