Exemple #1
0
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static as st
from django.views import static
from django.conf.urls import url
from django.views.generic import TemplateView
from blog import settings
from content.views import IndexView

urlpatterns = [
    path('blog/', admin.site.urls),
    path("", IndexView.as_view(), name="index"),
    path("about/",
         TemplateView.as_view(template_name="about.html"),
         name="about"),
    path('uploader/', include('ckeditor_uploader.urls')),
    path("note/", include("note.urls")),
    path("post/", include("post.urls")),
    url(r'^static/(?P<path>.*)$',
        static.serve, {'document_root': settings.STATIC_ROOT},
        name='static'),
]

urlpatterns += st(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
# urlpatterns += serve(settings.STATIC_URL, document_root=settings.STATICFILES_DIRS)
Exemple #2
0
"""jz_archs URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    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 django.conf import settings
from django.conf.urls.static import static
from content.views import IndexView, ProjectDetailView, AboutView, ContactView

urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('projects/<slug>/', ProjectDetailView.as_view(), name='info'),
    path('worklist/', AboutView.as_view(), name='about'),
    path('contacts/', ContactView.as_view(), name='contacts'),
    path('admin/', admin.site.urls),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemple #3
0
from django.conf.urls import url
from content import views
from content.views import ProfileView, EditorView, ShowView, LikeView, IndexView
urlpatterns = [
    url(r'^index/(\d*)$', IndexView.as_view(), name='index'),  # 首页
    url(r'^profile$', ProfileView.as_view(), name='profile'),  # 网站简介
    url(r'^editor$', EditorView.as_view(), name='editor'),  # 编辑
    url(r'^show/(\d+)$', ShowView.as_view(), name='show'),  # 内容展示
    url(r'^like$', LikeView.as_view(), name='like'),  # 收藏夹处理
    url(r'^dellike/(\d+)$', views.dellike, name='dellike')  # 删除收藏
]
Exemple #4
0
    PageView,
    stat,
)
from content.sitemap import (
    ArticleSitemap,
    PageSitemap,
    CategorySitemap,
    IndexSitemap,
    TagSitemap,
)
from content.views import upload_md_files

urlpatterns = [
    path('admin/', admin.site.urls),
    path('stat/', stat, name='stat'),
    path('', cache_page(30)(IndexView.as_view()), name='index'),
    path('article/<pk>/',
         cache_page(30)(ArticleView.as_view()),
         name='article'),
    path('category/<int:cat_id>/',
         cache_page(30)(CategoryView.as_view()),
         name='category'),
    path('tag/<int:tag_id>/', cache_page(30)(TagView.as_view()), name='tag'),
    path('uploadmd/', upload_md_files, name='upload'),
    path('<link_word>/', cache_page(30)(PageView.as_view()), name='page'),
    path('sitemap.xml',
         cache_page(30)(sitemap), {
             'sitemaps': {
                 'index': IndexSitemap,
                 'category': CategorySitemap,
                 'tag': TagSitemap,
Exemple #5
0
    callback = urlpattern.callback
    for decorator in reversed(decorators):
        callback = decorator(callback)

    return RegexURLPattern(
        urlpattern.regex.pattern,
        callback,
        urlpattern.default_args,
        urlpattern.name
    )

urlpatterns = i18n_patterns(
    url(r'^admin/', admin.site.urls),
    # url(r'', include('two_factor.urls', 'two_factor')),
    #url(r'', include(two_factor_urls, 'two_factor')),
    url(r'^$', IndexView.as_view(), name='index'),
    # landing
    url(r'^$', IndexView.as_view(), name='landing'),
    url(r'^old/$', IndexOldView.as_view(), name='old'),
    url(r'^subscription/$', subscribe, name='subscription'),
    url(r'^unsubscribe/(?P<pk>[0-9]+)/$', unsubscribe, name='unsubscribe'),
    url(r'^ask_question/$', ask_question, name='ask_question'),
    url(r'^open_pdf/(?P<name>\w+)/(?P<lang>[A-Za-z]+)/$', open_pdf, name='open_pdf'),

    # profile
    url(r'^profile/$', ProfileView.as_view(), name='profile'),
    url(r'^set_settings/$', set_user_settings, name='set_settings'),
    url(r'^save_transaction', save_transaction, name='save_transaction'),
    url(r'^set_wallet/$', save_wallet_for_bonus, name='set_wallet'),

    # auth
Exemple #6
0
    1. Add an import:  from my_app import views
    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'))
"""
import os

from django.conf import settings
from django.contrib import admin
from django.urls import path, include
from django.conf.urls.static import static

from content.views import IndexView, PageView

urlpatterns = [
    path('tinymce/', include('tinymce.urls')),
    path('admin/', admin.site.urls),
]

if settings.DEBUG:
    urlpatterns += static('/static/',
                          document_root=os.path.join(settings.BASE_DIR,
                                                     'static'))

urlpatterns.append(path('<slug:slug>/', PageView.as_view()))
urlpatterns.append(path('', IndexView.as_view()))