示例#1
0
from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from djangorestframework.permissions import IsUserOrIsAnonReadOnly
from api.resources import AllPetitionsResource, PetitionResource, SignatureResource

from api.views import HomeView

urlpatterns = patterns('',
    # Examples:
    url(r'^$', HomeView.as_view(), name='home'),
    # url(r'^WeThePeopleApi/', include('WeThePeopleApi.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    # url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    url(r'^admin/', include(admin.site.urls)),
    
    # Example for API app
    # url(r'^objects/$', ListOrCreateModelView.as_view(resource=ObjectResource), name='object-root'),
    # url(r'^objects/(?P<id>[^/]+)/$', InstanceModelView.as_view(resource=ObjectResource), name='object'),

    # Make read-only unless admin
    #class permissions.IsUserOrIsAnonReadOnly(VIEW??)
    # Petitions and Signatures API urls
    url(r'^petitions/$', ListOrCreateModelView.as_view(resource=AllPetitionsResource), name='petitions'),
示例#2
0
from django.conf.urls import url
from django.urls import path
from api.views import HomeView, AlbumsView, NewsView, ArticleView, Pop30View, EventView
from . import views

app_name = 'api'

urlpatterns = [
    # url(r'^$', HomeView.as_view(), name = 'home'),
    path('', HomeView.as_view(), name='home'),
    # path('albums/', views.albums, name="albums"),
    path('albums/', AlbumsView.as_view(), name='albums'),
    path('news/', NewsView.as_view(), name='news'),
    path('event/', EventView.as_view(), name='event'),
    path('article/', ArticleView.as_view(), name='article'),
    path('pop30/', Pop30View.as_view(), name='pop30'),
]
示例#3
0
文件: urls.py 项目: orlovw/Forum
schema_view = get_schema_view(
    openapi.Info(
        title="Forum API",
        default_version='v1',
        description="Forum application programming interface",
        terms_of_service="https://www.google.com/policies/terms/",
        contact=openapi.Contact(email="*****@*****.**"),
        license=openapi.License(name="BSD License"),
    ),
    public=True,
    permission_classes=(permissions.AllowAny, ),
)

front_end_url_integration = [
    path('conversation/<str:section>/topic/<int:id>', HomeView.as_view()),
    path('login', HomeView.as_view()),
    path('user-profile/<int:user_id>', HomeView.as_view()),
    path('get-started', HomeView.as_view()),
    path('sections', HomeView.as_view()),
    path('conversation/<str:section>', HomeView.as_view()),
    path('topic-editing/<str:section>/<int:id>', HomeView.as_view()),
    path('teams/manage-team-members', HomeView.as_view()),
    path('teams/', HomeView.as_view()),
    path('edit-team/<int:team_id>', HomeView.as_view()),
    path('teams/<int:team_id>', HomeView.as_view()),
    path('shop', HomeView.as_view()),
    path('registration', HomeView.as_view()),
]

urlpatterns = [
示例#4
0
from django.urls import path, include
from . import views
from rest_framework import routers
from api.views import APIListView, APIView, WordListViewSet, HomeView
from django.conf.urls import url

# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'url_input', WordListViewSet)

app_name = "api"

urlpatterns = [
    path(
        '', include(router.urls)
    ),  #Whenever Django encounters include(), it chops off whatever part of the URL matched
    # up to that point and sends the remaining string to the included URLconf for further processing.
    # path('form/', views.HomeView, name='index'),
    url(
        'form/', HomeView.as_view(), name='index'
    )  #as_view returns a function instead of class, inherets from TemplateView
]
#more info: https://docs.djangoproject.com/en/3.0/topics/http/urls/#url-namespaces
示例#5
0
    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 django.conf import settings
from django.conf.urls.static import static

from api import views
from api.views import HomeView, CameraView, ResultView

urlpatterns = [
    path('', HomeView.as_view(), name="home"),
    path('api/', include('api.urls')),
    path('camera/', CameraView.as_view(), name="camera"),
    path('result/', ResultView.as_view(), name="result"),
    path('admin/', admin.site.urls),
]

# When the debug mode is false,
if settings.DEBUG:
    urlpatterns += static(settings.STATIC_URL,
                          document_root=settings.STATIC_ROOT)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)

admin.site.site_header = "Happiness Guru Adminstration"
admin.site.site_title = "Happiness Guru Adminstration"
示例#6
0
"""cinta_n 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, include
from django.contrib import admin
from api.views import HomeView, index

 
urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^api/', include('api.api.urls', namespace="api")),
    url(r'$', HomeView.as_view(), name='homeview'),
    ]
示例#7
0
文件: urls.py 项目: hectorip/CN_API
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
from api.views import HomeView, index
from django.http import HttpResponse
urlpatterns = [
    url(r'^admin/', admin.site.urls), # varias urls
    url(r'^api/', include('api.urls', namespace="api")),
    url(r'^$', HomeView.as_view(),  name="homeview") # una sola url
]