Exemple #1
0
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    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'))
"""
from django.conf.urls import url, include
# from django.contrib import admin
import xadmin
import settings
from blog.views import IndexView, DetailView, TagView, SearchView
from django.conf.urls.static import static

urlpatterns = [
    url(r'^xadmin/', xadmin.site.urls, name="xadmin"),
    url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}, name="media"),
    url(r'^$', IndexView.as_view(), name="index"),
    url(r'^(?P<id>\d+)/$', DetailView.as_view(), name='detail'),
    url(r'^tag/(?P<tagId>.*)/$', TagView.as_view(), name='tag'),
    url(r'^search/$', SearchView.as_view(), name='search'),
    url(r'^ueditor/', include('DjangoUeditor.urls')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Exemple #2
0
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'),
]
Exemple #3
0
# encoding: utf-8
'''
@author: dbj
@file: urls.py
@time: 2021/4/2 11:42
@desc:
'''
from django.urls import path
from blog.views import IndexView, DetailView

urlpatterns = [
    # 首页的路由 即什么路径都不写就会跳转到首页
    path('index/', IndexView.as_view(), name='index'),
    path('detail/', DetailView.as_view(), name='detail'),
]
Exemple #4
0
#!usr/bin/python3
#-*- coding:utf-8 -*-

from django.conf.urls import url
from django.urls import re_path, path

from blog.views import CategoryView, ArchiveView, DetailView, TagView, AboutView, ConnectView,SearchView

app_name='blog'
urlpatterns = [

    # 文章详情页
    re_path('post/(?P<pk>[0-9]+)/', DetailView.as_view(),name='detail'),
    # 按年月查找
    re_path('archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/', ArchiveView.as_view(), name='archives'),
    # 按分类查找
    re_path('category/(?P<pk>[0-9]+)/', CategoryView.as_view(), name='category'),
    # 按分类查找
    re_path('tag/(?P<pk>[0-9]+)/', TagView.as_view(), name='tag'),
    path('about/', AboutView.as_view(), name='about'),
    path('connect/', ConnectView.as_view(), name='connect'),
    path('search/', SearchView.as_view(), name='search'),
]
Exemple #5
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    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'))
"""
from django.conf.urls import url
from django.contrib import admin
from rest_framework.authtoken import views as drf_views

from blog.views import HomeView, DetailView, CategoryView
from arcade.views import ArcadeView, MachineListView, MachineUpdateView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', HomeView.as_view(), name='index'),
    url(r'^yazi/(?P<pattern>.*)$', DetailView.as_view()),
    url(r'^cocuklaricinoyna/$', ArcadeView.as_view(), name='arcade'),
    url(r'^api/arcade/all/$', MachineListView.as_view()),
    url(r'^api/arcade/(?P<pk>[0-9]+)/$', MachineUpdateView.as_view()),
    url(r'^kategori/(?P<pattern>.*)/$', CategoryView.as_view()),
    url(r'^get_auth_token/$', drf_views.obtain_auth_token, name='get_auth_token')
]
Exemple #6
0
from django.conf.urls import url

from blog.views import IndexView, BlogView, AboutView, ContactView, DetailView, ArchivesView, CategoryView, TagView

urlpatterns = [
    url(r'^$', IndexView.as_view(), name='首页'),
    url(r'^detail/(?P<pk>[0-9]+)/$', DetailView.as_view(), name='详情'),
    url(r'^archives/(?P<year>[0-9]{4})/(?P<month>[0-9]{1,2})/$',
        ArchivesView.as_view(),
        name='归档'),
    url(r'^category/(?P<pk>[0-9]+)/$', CategoryView.as_view(), name='分类'),
    url(r'^tag/(?P<pk>[0-9]+)/$', TagView.as_view(), name='标签'),
    url(r'^blog$', BlogView.as_view(), name='博客'),
    url(r'^about$', AboutView.as_view(), name='关于'),
    url(r'^contact$', ContactView.as_view(), name='联系'),
]
Exemple #7
0
# -*- coding: utf-8 -*-
"""dj_project URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.10/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    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'))
"""
from django.conf.urls import url
from django.contrib import admin
from blog.views import DetailView, IndexView
from editor.views import update, edit

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^blog/(?P<pk>[0-9]+)/$', DetailView.as_view(), name='detail'),
    url(r'^edit/(?P<blog_id>[0-9]+)/$', edit, name='edit'),
    url(r'^update/(?P<blog_id>[0-9]+)/$', update, name='update'),
]