Пример #1
0
"""outletwrite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/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, include
from blog.views import ArticleList, ArticleDetail

urlpatterns = [
    path('admin/', admin.site.urls),
    path('api/articles/', ArticleList.as_view(), name='article_list'),
    path('api/articles/<int:pk>/',
         ArticleDetail.as_view(),
         name='article_detail'),
]
Пример #2
0
"""blog_manipal URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.8/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. Add an import:  from blog import urls as blog_urls
    2. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""

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

urlpatterns = [
    url(r'^admin', include(admin.site.urls)),
    url(r'^$', ArticleList.as_view()),
    url(r'^post-comment', views.post_comment, name="post-comment")
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Пример #3
0
from django.conf.urls import url, include
from blog.views import UserList, ArticleList, ArticleDetail

urlpatterns = [
    url(r'^users/$', UserList.as_view(), name="user-list"),
    url(r'^articles/$', ArticleList.as_view(), name="article-list"),
    url(r'^article/(?P<pk>[0-9]+)/$', ArticleDetail.as_view()),
    url(r'^', include('rest_framework.urls')),
]
Пример #4
0
from registration.backends.simple.views import RegistrationView

from blog.views import ArticleList, ArticleDetail
from .settings import DEBUG

admin.autodiscover()
admin.site.site_header = 'Сенат ФОПФ'
admin.site.index_title = "Администрирование DGAP services"


class MyRegistrationView(RegistrationView):
    success_url = '/profiles'


urlpatterns = [
    url(r'^$', ArticleList.as_view(), name='index'),
    url(r'^polls/', include('polls.urls', namespace='polls')),
    url(r'^blog/', include('blog.urls', namespace='blog')),
    url(r'^bicycle/', include('cycle_storage.urls', namespace='bicycle')),
    # url(r'^laundry/', RedirectView.as_view(url="http://stiralka.mipt.ru"), name="laundry"),
    # url(r'^print/', RedirectView.as_view(url="http://print.mipt.ru"), name="print"),
    url(r'^aid/', include('fin_aid.urls', namespace='fin_aid')),
    url(r'^senate/', include('senate.urls', namespace='senate')),
    url(r'^servertime/', include('servertime.urls', namespace='servertime')),
    url(r'^profiles/', include('profiles.urls', namespace='profiles')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^accounts/register/$',
        MyRegistrationView.as_view(),
        name='registration_register'),
    url(r'^accounts/', include('registration.backends.simple.urls')),
    url(r'^accounts/', include('django.contrib.auth.urls')),
Пример #5
0
from django.conf.urls import url

from blog.views import IndexView, ArticleDetailView, CategoryView, custom, ArticleList, ArticleDetail, TagsView, about

urlpatterns = [

    # 首页调用IndexView
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^index.html/$', IndexView.as_view(), name='index'),  # .html 处理方式不对哦

    # 使用(?P<>\d+)的形式捕获值给<>中得参数,比如(?P<article_id>\d+),当访问/blog/article/3时,
    # 将会将3捕获给article_id,这个值会传到views.ArticleDetailView,这样我们就可以判断展示哪个Article了
    url(r'article/(?P<article_id>\d+)$', ArticleDetailView.as_view(), name='detail'),
    url(r'category/(?P<cate_id>\d+)$', CategoryView.as_view(), name='category'),
    url(r'^custom/$', custom),
    url(r'^tags/$', TagsView.as_view(), name='tags'),
    url(r'^about/$', about, name='about'),

    # api
    url(r'api/v1/articles$', ArticleList.as_view()),
    url(r'api/v1/articles/(?P<article_id>\d+)$', ArticleDetail.as_view()),

]
Пример #6
0
from django.contrib import admin
from django.urls import path, include

from blog.views import ArticleList, ArticleUser, ArticleDetail, SubscribeBlog, ReadArticleView

urlpatterns = [
    path('', ArticleList.as_view(), name='article-list'),
    path('article-list/<int:pk>/',
         ArticleDetail.as_view(),
         name='article-detail'),
    path('article-user/', ArticleUser.as_view(), name='article-user'),
    path('subscribe/<int:pk>/', SubscribeBlog.as_view(),
         name='subscribe_blog'),
    path('read/<int:pk>/', ReadArticleView.as_view(),
         name='read_article_view'),
]
Пример #7
0
from django.urls import path, re_path
from blog.views import CreateArticle, ArticleList, CategoryList, CategoryCount, NextArticle

urlpatterns = [
    path('createArticle/l', CreateArticle.as_view()),  # 创建/更新文章
    re_path('articleList/?', ArticleList.as_view()),  # 获取文章列表
    re_path('categoryList/?', CategoryList.as_view()),  # 获取文章列表
    re_path('articleCount/?', CategoryCount.as_view()),  # 获取文章列表数量
    re_path('nextArticle/?', NextArticle.as_view()),  # 获取文章上一个下一个
]
Пример #8
0
from django.urls import path
from blog.views import api,article_detais,category_list,ArticleList,ArticleDetails,CategoryList,AuthorList
app_name="blog"
urlpatterns = [
    path('', ArticleList.as_view(), name="home"),
    path('page/<int:page>', ArticleList.as_view(), name="home"),

    path('api', api, name="api"),

    path('article/<slug:slug>', ArticleDetails.as_view(), name="article_detais_url"),

    path('category/<slug:slug>', CategoryList.as_view(), name="category_list_url"),
    path('category/<slug:slug>/page/<int:page>', CategoryList.as_view(), name="category_list_url"),

    path('author/<slug:username>', AuthorList.as_view(), name="author_list_url"),
    path('author/<slug:username>/page/<int:page>', AuthorList.as_view(), name="author_list_url"),

]
Пример #9
0
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import url, include
from django.views.static import serve

import xadmin

from blog.views import (ArticleList, ArticleDetail, TagArticleList,
                        CatArticleList, sitemap, robot_txt, ClapRecordView,
                        MusicView)

xadmin.autodiscover()

urlpatterns = [
    url(r'^$', ArticleList.as_view()),
    url(r'^/$', ArticleList.as_view()),
    url(r'^static/(?P<path>.*)$', serve,
        {'document_root': settings.STATIC_ROOT}),
    url(r'^articles/$', ArticleList.as_view()),
    url(r'^articles/(?P<article_id>[0-9]+)/$', ArticleDetail.as_view()),
    url(r'^tags/(?P<tag_id>[0-9]+)/articles', TagArticleList.as_view()),
    url(r'^category/(?P<cat_id>[0-9]+)/articles', CatArticleList.as_view()),
    url(r'^articles/clap/$', ClapRecordView.as_view()),
    url(r'^music/$', MusicView.as_view()),
    url(r'xadmin/', include(xadmin.site.urls[:2])),
    url(r'sitemap/', sitemap),
    url(r'robots.txt/', robot_txt),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)