Пример #1
0
from django.conf.urls import patterns, url
from api.views import ArticleDetailView, CommentView, LoginCallbackView, CommentListView, UserInfoView, ArticleListView, \
    ClassificationView, TagView, UploadView, KnowListView, KnowDetailView, CollectionsListView

urlpatterns = patterns(
    '',
    url(r'^articles', ArticleListView.as_view()),
    url(r'^article/(?P<aid>(\d)+)/comments$', CommentListView.as_view()),
    url(r'^article/(?P<aid>(\d)+)/comment$', CommentView.as_view()),
    url(r'^article/(?P<aid>(\d)+)$', ArticleDetailView.as_view()),
    url(r'^article/(?P<slug>([a-z0-9-])+)$', ArticleDetailView.as_view()),
    url(r'^login/callback$', LoginCallbackView.as_view()),
    url(r'^user/info$', UserInfoView.as_view()),
    url(r'^tags$', TagView.as_view()),
    url(r'^classifications', ClassificationView.as_view()),
    url(r'^upload', UploadView.as_view()),
    url(r'^knowledge/(?P<kid>(\d)+)$', KnowDetailView.as_view()),
    url(r'^knowledge', KnowListView.as_view()),
    url(r'^collections', CollectionsListView.as_view()),
)
Пример #2
0
"""nflx URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    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
from django.contrib import admin
from api.views import UploadView, AggregateView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^api/v1/upload/$', UploadView.as_view()),
    url(r'^api/v1/aggregate/$', AggregateView.as_view())
]
Пример #3
0
from django.conf.urls import url, include
from django.contrib import admin
from api.views import UploadView

urlpatterns = [
    url('admin/', admin.site.urls),
    url('upload/', UploadView.as_view(), name='upload'),
    url('api/', include('api.urls'))
]
Пример #4
0
from django.urls import path, include
from api.views import UploadView, GamesView, GamesDetailedView

urlpatterns = [
    path('upload', UploadView.as_view(), name="upload_view"),
    path('games', GamesView.as_view(), name="games_view"),
    path('games/<pk>', GamesDetailedView.as_view(), name='games_detailed_view')
]