def test_root_url_resolves_to_index_view(self): request = RequestFactory().get('/home') view = IndexView.as_view(template_name='index.html') # Run. response = view(request) # Check. self.assertEqual(response.status_code, 200)
from django.urls import path from home.views import IndexView app_name = 'home' urlpatterns = [ path('', IndexView.as_view()), ]
from home.views import IndexView, Describe router = routers.SimpleRouter() router.register(r'accounts', AccountViewSet) router.register(r'posts', PostViewSet) account_router = routers.NestedSimpleRouter( router, r'accounts', lookup='account' ) account_router.register(r'posts', AccountPostsViewSet) urlpatterns = [ # API # Browsable API url(r'^api/v1/', include(router.urls)), url(r'^api/v1/', include(account_router.urls)), # Login & Logout url(r'^api/v1/auth/login/$', LoginView.as_view(), name='login'), url(r'^api/v1/auth/logout/$', LogoutView.as_view(), name='logout'), # Describe Objects url(r'^api/v1/describe/(?P<object_name>\w+)/$', Describe.as_view(), name='describe'), # Home Page url('^.*$', IndexView.as_view(), name='index'), ]
from django.urls import path, re_path from home.views import IndexView, ArchivesView, LinkView, AboutView from django.conf.urls import url urlpatterns = [ path('archives/', ArchivesView.as_view(), name='archives'), # archives归档 path('link/', LinkView.as_view(), name='link'), # link 链接 path('about/', AboutView.as_view(), name='about'), # about 关于我 re_path(r'^index(\d*)/$', IndexView.as_view()), # index 主页 path('', IndexView.as_view(), name='index'), # index 主页 ]
from django.urls import path from home.views import IndexView, DetailView urlpatterns = [ # 首页的路由 path('', IndexView.as_view(), name='index'), #详情视图的路由 path('detail/', DetailView.as_view(), name='detail'), ]
from django.urls import path from home.views import IndexView app_name = 'Home' urlpatterns = [path('', IndexView.as_view(), name='landing')]
from django.urls import path from home.views import IndexView app_name = 'home' urlpatterns = [path('', IndexView.as_view(), name='index')]
from django.urls import path from home.views import IndexView, DetailView urlpatterns = [ path("", IndexView.as_view(), name="index"), path("detail/", DetailView.as_view(), name='detail') ]
from django.urls import path from home.views import IndexView app_name = 'Home' urlpatterns = [ path('',IndexView.as_view(),name='start_page') ]
from django.conf import settings from django.contrib import admin from django.urls import include, re_path from django.views.static import serve from home.views import IndexView urlpatterns = [ ################################################## # / Home page. re_path(r'^$', IndexView.as_view(), name='home_page'), ################################################## # /accounts/* re_path(r'^accounts/', include('accounts.urls')), # /auth/* re_path(r'^auth/', include('authentication.urls')), # /contact/* re_path(r'^contact/', include('contact.urls')), # /home/* re_path(r'^home/', include('home.urls')), # /pages/* re_path(r'^pages/', include('pages.urls')), # /admin/* re_path(r'^admin/', admin.site.urls), ]
"""BambooPiSv 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 include,path from home.views import IndexView from django.conf import settings # app_name = 'home' urlpatterns = [ # トップ画面(一覧画面) path('', IndexView.as_view(), name='home'), ] if settings.DEBUG: import debug_toolbar urlpatterns = [path('__debug__/', include(debug_toolbar.urls))] + urlpatterns
from django.conf import settings from django.conf.urls import include, url from django.contrib import admin from django.views.static import serve from home.views import IndexView urlpatterns = [ ################################################## # / Pagina de inicio. url(r"^$", IndexView.as_view(), name="home_page"), ################################################## # /home/* url(r"^home/", include("home.urls")), # /accounts/ url(r"^accounts/", include("allauth.urls")), # /admin/* url(r"^admin/", include(admin.site.urls)), ] if settings.DEBUG: # static files (images, css, javascript, etc.) urlpatterns.append( # /media/:<mixed>path/ url(r"^media/(?P<path>.*)$", serve, kwargs={"document_root": settings.MEDIA_ROOT}) )
from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() from home.views import IndexView urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='home.home'), url(r'^news/', include('blog.urls')), url(r'^admin/', include(admin.site.urls)), url(r'^events/', include('schedule.urls')), url(r'^contact/', include('contact.urls')), url(r'^information/', include('information.urls')), url(r'^register/', include('register.urls')), url(r'^publications/', include('publications.urls')), url(r'^atas/', include('atas.urls')), url(r'^tinymce/', include('tinymce.urls')), ) from django.conf import settings urlpatterns += patterns('', (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}), )
""" from django.conf.urls import url, include from django.contrib import admin from home.views import IndexView, send_email from panampath.views import MapView from django.views.generic import TemplateView from django.conf import settings from django.conf.urls.static import static from djgeojson.views import GeoJSONLayerView from panampath.models import PathSegment from filebrowser.sites import site urlpatterns = [ url('admin/filebrowser/', site.urls), url(r'grappelli/', include('grappelli.urls')), url(r'^admin/', admin.site.urls), url(r'^$', IndexView.as_view(), name="home"), url(r'^submit-event/$', send_email, name="submit_event"), url(r'^map/', MapView.as_view(), name="map"), # url(r'^story/', TemplateView.as_view(template_name='story.html')), url(r'^blog/', include('zinnia.urls')), url(r'^comments/', include('django_comments.urls')), url(r'^ckeditor/', include('ckeditor_uploader.urls')), url(r'^data.geojson$', GeoJSONLayerView.as_view(model=PathSegment, properties=('title', 'description', 'picture_url')), name='data') ] urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
from django.conf.urls import patterns from home.views import IndexView from home.views import CodeView from home.views import ConfirmView urlpatterns = patterns('', (r'^$', IndexView.as_view()), (r'^(?P<code>[a-zA-Z0-9]{3})/?$', IndexView.as_view()), (r'^(?P<code>[a-zA-Z0-9]{3})/card/?$', IndexView.as_view(mode='card')), (r'^(?P<code>[a-zA-Z0-9]{3})/rsvp/?$', IndexView.as_view(mode='rsvp')), (r'^(?P<code>[a-zA-Z0-9]{3})/map/?$', IndexView.as_view(mode='map')), (r'^code/?$', CodeView.as_view()), (r'^confirm/?$', ConfirmView.as_view()), )
from django.conf.urls import patterns, include, url from django.contrib import admin from home.views import IndexView urlpatterns = patterns( '', url(r'^$', IndexView.as_view(), name='index'), url(r'^api/', include('api.urls')), url(r'^admin/', include(admin.site.urls)), )
from django.conf.urls import patterns, url from home.rss import LatestVideos from home.views import AboutView, BrowseView, IndexView, CategoryView urlpatterns = patterns( "", url(r"^rss/main", LatestVideos(), name="main_rss"), url(r"^$", IndexView.as_view(), name="index"), url(r"^browse/$", BrowseView.as_view(), name="browse"), url(r"^about/$", AboutView.as_view(), name="about"), url(r"^category/(?P<slug>[-\w]+)/$", CategoryView.as_view(), name="category"), url(r"^favorite/add/$", "favorite.views.toggle_favorite", name="favorite_toggle"), )
def setUp(self): request = RequestFactory().get('/') self.response = IndexView.as_view()(request)
from django.conf import settings from django.conf.urls.static import static from django.contrib import admin from django.urls import path, include, re_path from home.views import ReturnToken, IndexView urlpatterns = [ path('api-auth/', include('rest_framework.urls')), path('rest-auth/', include('rest_auth.urls')), path('rest-auth/registration/', include('rest_auth.registration.urls')), path('admin/', admin.site.urls), path('api/', include('core.api.urls')), path('accounts/', include('allauth.urls')), path('returntoken', ReturnToken.as_view(), name='returntoken'), re_path('.*', IndexView.as_view()), ] if settings.DEBUG: urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) # urlpatterns += [re_path(r'^.*', # TemplateView.as_view(template_name='index.html'))]
from django.urls import path from home.views import IndexView, DetailView urlpatterns = [ # 首页路由 path('', IndexView.as_view(), name='index'), # 博客详情路由 path('detail/', DetailView.as_view(), name='detail'), ]
""" Accomulate qrecipe app urls """ from django.conf.urls import patterns, url from home.views import IndexView urlpatterns = patterns( '', url(r'^(?P<slug>home)?(/)?$', IndexView.as_view(), name='home'), )
from django.conf.urls import url from home.views import IndexView, DetailView urlpatterns = [ url(r'^$', IndexView.as_view(), name='index'), url(r'^detail/', DetailView.as_view(), name='detail'), ]
from django.conf.urls import patterns, url from home.rss import LatestVideos from home.views import AboutView, BrowseView, IndexView, CategoryView urlpatterns = patterns( '', url(r'^rss/main', LatestVideos(), name="main_rss"), url(r'^$', IndexView.as_view(), name="index"), url(r'^browse/$', BrowseView.as_view(), name="browse"), url(r'^about/$', AboutView.as_view(), name="about"), url(r'^category/(?P<slug>[-\w]+)/$', CategoryView.as_view(), name='category'), url(r'^favorite/add/$', 'favorite.views.toggle_favorite', name='favorite_toggle'), )
def test_logout(self): request = create_request(is_post=False, url='/user/manage/', is_anonymous=True) response = IndexView.as_view()(request) assert response.status_code == 200, "Error"