from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib import admin admin.autodiscover() from django.views.generic import TemplateView from blog.views import archive,hello,HomePageView,ItemsPageView,ItemDetailView,PhotoDetailView from blog.models import Item,Photo from myblog.settings import STATIC_ROOT urlpatterns = patterns('', # Examples: # url(r'^$', 'myblog.views.home', name='home'), url(r'^static/(?P<path>.*)$','django.views.static.serve',{'document_root':STATIC_ROOT},name = 'static'), url(r'^admin/', include(admin.site.urls)), url(r'^cms/',include('cms.urls')), url(r'^hello/$',hello), url(r'^blog/$',HomePageView.as_view(),name = 'index'), url(r'^blog/items/$',ItemsPageView.as_view(),name = 'item_list'), url(r'^blog/items/(?P<pk>\d+)/$',ItemDetailView.as_view(),name = 'item_detail'), url(r'^blog/photos/(?P<pk>\d+)/$',PhotoDetailView.as_view(),name = 'photo_detail'), )
from django.urls import path from django.views.generic import TemplateView from blog.views import list_post, update_post, delete_post, create_post, HomePageView, \ MyView, PostList, PostDetail, PostCreate, PostUpdate, PostDelete urlpatterns = [ path('', list_post, name='list'), path('create/', create_post, name='create'), path('update/<int:pk>', update_post, name='update'), path('delete/<int:pk>', delete_post, name='delete'), # class based views path('home/', TemplateView.as_view(template_name='blog/post_list.html'), name='nome'), path('home1/', HomePageView.as_view(), name='home1'), path('view/', MyView.as_view(), name='view_post'), path('list/', PostList.as_view(), name='list_post'), path('detail/<int:pk>/', PostDetail.as_view(), name='detail_post'), path('post_create/', PostCreate.as_view(), name='create_post'), path('post_update/<int:pk>', PostUpdate.as_view(), name='update_post'), path('post_delete/<int:pk>', PostDelete.as_view(), name='delete_post') ]
from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.contrib import admin from blog.views import HomePageView __author__ = 'Derek Stegelman' __date__ = '11/10/12' admin.autodiscover() urlpatterns = patterns('', url(r'^accounts/login/$', 'django.contrib.auth.views.login', {'template_name': 'profile/login.html'}), url(r'^accounts/logout/$', 'django.contrib.auth.views.logout', {'template_name': 'profile/logout.html'}, name="logout"), url(r'^admin/', include(admin.site.urls)), url(r'^traveler/', include("traveler.urls")), url(r'^blog/', include("blog.urls")), url(r'^$', HomePageView.as_view(), name="home"), ) if settings.LOCAL: url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), urlpatterns += staticfiles_urlpatterns()
from django.urls import path from blog.views import HomePageView, ListPageView, DetailPageView # enables namespacing app_name = 'blog' urlpatterns = [ path('', HomePageView.as_view(), name='home-page'), path('posts/', ListPageView.as_view(), name='list-page'), path('<slug:slug>/', DetailPageView.as_view(), name='detail-page') ]
"""testweb 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 path, include from blog.views import HomePageView from django.contrib.auth import views as auth_views urlpatterns = [ path('', HomePageView.as_view(), name='homemain'), path('admin/', admin.site.urls), path('blog/', include('blog.urls'), name='blog'), path('accounts/login/', auth_views.LoginView.as_view(), name='login'), path('accounts/logout/', auth_views.LogoutView.as_view(), name='logout', kwargs={'next_page': '/blog'}) ]
#!/usr/bin/env python # -*- coding: utf-8 -*- from django.conf.urls import patterns, include, url from tastypie.api import Api from blog.views import HomePageView, PostPageView from blog.api import PostsResource, TagsResources from blog.feeds import LatestEntriesFeed posts_resource = PostsResource() v1_api = Api('v1') v1_api.register(PostsResource()) v1_api.register(TagsResources()) urlpatterns = patterns('', url(r'^$', HomePageView.as_view(), name='home'), url(r'post/(?P<pk>\d+)/$', PostPageView.as_view(), name='post'), url(r'^api/', include(v1_api.urls), name='api'), url(r'^rss/$', LatestEntriesFeed(), name='rss'), )
"""blog 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 blog.views import HomePageView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomePageView.as_view()), ]
from django.conf.urls import url from blog.views import MyView from blog.views import HomePageView #所有的url匹配都有一个起始url链接比如http://127.0.0.1:8000 #name属性为网址的别名 urlpatterns = [ #该path匹配了所有的url #path('',learn_views.index), #path('add/', calc_views.add, name='add'), #Django支持优雅的url path('newadd/<int:a>/<int:b>/', calc_views.add2, name='add2'), path('admin/', admin.site.urls), #path('',calc_views.index,name='home'), path('', learn_views.home, name="home"), #匹配add/整数/整数 的url #path('add/<int:a>/<int:b>/',learn_views.add,name="learnadd"), path('logic/<int:var>/', learn_views.logic, name="logic"), path('login/<str:user>/', learn_views.login, name="login"), path('add/', blog_views.add, name="blogadd"), #path('',blog_views.index,name="blogindex"), path('blog/index2', blog_views.index2, name="blogindex2"), path('ajax_list/', blog_views.ajax_list, name="ajaxlist"), path('ajax_dict/', blog_views.ajax_dict, name="ajaxdict"), path('mine/', MyView.as_view(), name="my-view"), path('TemplateView/', HomePageView.as_view(), name="templateview"), path('blog_home/', blog_views.index3, name="bloghome"), path('blog_columns/', blog_views.columns, name="blogcolumns"), ]
from django.urls import path from blog.views import HomePageView urlpatterns = [ path('', HomePageView.as_view(), name='index'), ]
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 ProfilListView, ProfilDetailView, ProfilUpdateView, HomePageView, ProfilCreateView, ProfilDeleteView, FollowView, UnFollowView, ProfilAutocomplete, ProfilMapView from django.conf import settings from django.conf.urls.static import static urlpatterns = [ path('admin/', admin.site.urls), path("profiles", ProfilListView.as_view(), name="profile_list"), path("profiles/<str:username>/", ProfilDetailView.as_view(), name="profile_detail"), path("profiles/<str:username>/edit/", ProfilUpdateView.as_view(), name="profil_update"), path("",HomePageView.as_view(),name="homepage"), path('accounts/', include('django.contrib.auth.urls')), path("profile/create/",ProfilCreateView.as_view(),name="profil_create"), path('profile/<str:username>/delete', ProfilDeleteView.as_view(), name='delete'), path('profile/<str:username>/follow/<str:friend_username>', FollowView.as_view(), name='follow'), path('profile/<str:username>/unfollow/<str:friend_username>', UnFollowView.as_view(), name='unfollow'), path(r'^profil-autocomplete/$', ProfilAutocomplete.as_view(), name='profil-autocomplete',), path("map/",ProfilMapView.as_view(), name="map"), # path('profile/messages/', include('postman.urls', namespace='postman')), ]
# coding: utf-8 from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin from blog.views import PhotoAlbumTagView, PhotoAlbumView,\ SinglePageView, SinglePageSidebarView, PostDetailView,\ PostListView, HomePageView, BlogPostListView,\ BlogPostTagListView, BlogPostDetailView, CatListView from shop.views import OrderFormView, OrderView, NewOrderView, UpdateOrderView admin.autodiscover() urlpatterns = patterns('', url(r'^$', HomePageView.as_view()), #url(r'^orders/$', NewOrderView.as_view(template_name='photo_buy.html')), url(r'^shop/orders/(?P<id>\w+)/edit$', UpdateOrderView.as_view(template_name='photo_buy.html')), url(r'^shop/orders/(?P<id>\w+)/(?P<action>\w+)$', NewOrderView.as_view(template_name='order.html')), url(r'^shop/orders/(?P<id>\w+)/$', NewOrderView.as_view(template_name='order.html')), url(r'^shop/orders/$', NewOrderView.as_view(template_name='order.html')), url(r'^home/$', HomePageView.as_view()), url(r'^blog/$', BlogPostListView.as_view()), url(r'^blog/page(?P<page>[0-9]+)/$', BlogPostListView.as_view()), url(r'^blog/(?P<pk>\d+)$', BlogPostDetailView.as_view()), url(r'^purchase/$', SinglePageView.as_view(template_name='singlepage.html', kw='purchase')), url(r'^thanks/$', SinglePageView.as_view(template_name='singlepage.html', kw='thanks')), url(r'^fail/$', SinglePageView.as_view(template_name='singlepage.html', kw='fail')), url(r'^blog/tag/(?P<tag>\D+)/$', BlogPostTagListView.as_view(template_name='blogpost_list.html')), url(r'^blog/posts/(?P<pk>\d+)/$', BlogPostDetailView.as_view(template_name='blogpost_detail.html')), url(r'^photoalbum/$', PhotoAlbumView.as_view()),
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 include, url from django.contrib import admin from django.views.generic import TemplateView from tests.views import AboutView from blog.views import HomePageView from django.conf import settings from django.conf.urls.static import static from django.contrib.auth import views urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^$', HomePageView.as_view(), name="home"), url(r'^blog/', include('blog.urls', namespace="blog")), url(r'^doubts/', include('doubts.urls', namespace="doubts")), url(r'^tests/', include('tests.urls', namespace="tests")), url(r'^users/', include('Users.urls', namespace="users")), url(r'^about/$', AboutView.as_view(), name="about"), url(r'^notes/', include("notes.urls", namespace="notes")), url(r'^study/material/', include("study_material.urls", namespace="study_material")), ] urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT) urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""mysite 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 path, include from django.views.generic.base import TemplateView from blog.views import HomePageView admin.autodiscover() urlpatterns = [ path('', HomePageView.as_view()), path('admin/', admin.site.urls), path('blog/', include('blog.urls')), ]