示例#1
0
from bookmark.views import BookmarkLV, BookmarkDV
from blog.views import PostLV, PostDV, PostCreateView, PostDeleteView, PostUpdateView

from django.conf.urls.static import static
from django.conf import settings

from mysite.views import UserCreationView, UserCreationDoneTV

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^accounts/register/$', UserCreationView.as_view(), name='register'),
    url(r'^accounts/register/done/$',
        UserCreationDoneTV.as_view(),
        name='register_done'),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^bookmark/$', BookmarkLV.as_view(), name='bookmark_index'),
    url(r'^bookmark/(?P<pk>\d+)$', BookmarkDV.as_view(), name='detail'),
    url(r'^blog/$', PostLV.as_view(), name='blog_index'),
    url(r'^blog/(?P<pk>\d+)$', PostDV.as_view(), name='blog_detail'),
    url(r'^blog/add/$', PostCreateView.as_view(), name="blog_add"),
    url(r'^blog/(?P<pk>[0-9]+)/delete/$',
        PostDeleteView.as_view(),
        name="blog_delete"),
    url(r'^blog/(?P<pk>[0-9]+)/update/$',
        PostUpdateView.as_view(),
        name="blog_update"),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
"""
r'^   =>  localhost:8000/
r'^admin ====> localhost:8000/admin
示例#2
0
    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 mysite.views import IndexView, DjangoView, UserCreateView, UserCreateDoneTV
from bookmark.views import BookmarkLV, BookmarkDV, BookmarkCV, BookmarkUV, BookmarkRV
from youtube.views import YoutubeLV, YoutubeDV
from blog.views import PostLV, PostDV, PostCV, PostUV, PostRV

from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', IndexView.as_view(),
        name='index'),  #정규식, 얘들이 정규식을 읽고 필요한 파일을 불러옴.
    url(r'^django$', DjangoView.as_view(), name='djangoIndex'),
    url(r'^accounts/register/$', UserCreateView.as_view(), name='register'),
    url(r'^accounts/register_done/$',
        UserCreateDoneTV.as_view(),
        name='register_done'),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^bookmark/$', BookmarkLV.as_view(), name='bookmark_index'),
    url(r'^bookmark/(?P<pk>\d+)/$', BookmarkDV.as_view(), name='detail'),
    url(r'^bookmark/add/$', BookmarkCV.as_view(), name='bookmark_create'),
    url(r'^bookmark/update/(?P<pk>[0-9]+)$',
        BookmarkUV.as_view(),
        name='bookmark_update'),
    url(r'^bookmark/delete/(?P<pk>[0-9]+)$',
        BookmarkRV.as_view(),
示例#3
0
"""mysite URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/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.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path

from mysite.views import IndexView

urlpatterns = [
    path('', IndexView.as_view()),
    path('admin/', admin.site.urls),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
示例#4
0
from django.contrib import admin
from mysite.views import IndexView
from bookmark.views import BookmarkLV, BookmarkDV
from blog.views import *
from django.conf.urls.static import static
from django.conf import settings
from mysite.views import *

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/', include('django.contrib.auth.urls')),
    url(r'^accounts/register/$', UserCreationView.as_view(), name='register'),
    url(r'^accounts/register/done/$',
        UserCreationDoneTV.as_view(),
        name='register_done'),
    url(r'^$', IndexView.as_view(), name="index"),
    url(r'^bookmark/$', BookmarkLV.as_view(),
        name='bookmark_index'),  #http://127.0.0.1:8000/bookmark
    url(r'^bookmark/(?P<pk>\d+)/$', BookmarkDV.as_view(), name="detail"),
    url(r'^blog/$', PostLV.as_view(), name='blog_index'),
    url(r'^blog/add/$', PostCreateView.as_view(), name="blog_add"),
    url(r'^blog/(?P<pk>[0-9]+)/delete/$',
        PostDeleteView.as_view(),
        name="blog_delete"),
    url(r'^blog/(?P<pk>[0-9]+)/update/$',
        PostUpdateView.as_view(),
        name="blog_update"),
    url(r'^elemental_battleground/$',
        GameTips_Elemental_Battleground_View.as_view(),
        name="elemental_battleground"),
    url(r'^factory_town_tycoon/$',
示例#5
0
from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
from rest_framework import routers
from django.conf import settings
from mysite.views import IndexView
#app views
from user_profile import views as upviews
# allauth views
from allauth.account import views as aviews
from allauth.socialaccount import views as saviews

router = routers.DefaultRouter()
router.register(r'profile', upviews.UserProfileViewSet)

urlpatterns = patterns('',
    # Examples:
    # url(r'^$', 'mysite.views.home', name='home'),
    # url(r'^blog/', include('blog.urls')),

    url(r'^admin/', include(admin.site.urls)),
    url(r'^$', IndexView.as_view(), name='index'),
    url(r'^account/', include('allauth.urls')),
    #urls for the API views
    url(r'^api/', include(router.urls)),
    #url(r'^api/myself/', upviews.current_user, name='myself'),

)
示例#6
0
from django.conf.urls import patterns, url, include
from mysite.views import IndexView
from rest_framework_nested import routers
from authentication.views import AccountViewSet, LoginView, LogoutView
from posts.views import AccountPostsViewSet, PostViewSet
from django.conf.urls.static import static
from django.conf import settings

router = routers.SimpleRouter()
router.register(r'accounts', AccountViewSet)

router.register(r'posts', PostViewSet)

accounts_router = routers.NestedSimpleRouter(
    router, r'accounts', lookup='account'
)
accounts_router.register(r'posts', AccountPostsViewSet)

urlpatterns = patterns(
     '',
    # ... URLs
    url(r'^api/v1/auth/login/$', LoginView.as_view(), name='login'),
    url(r'^api/v1/auth/logout/$', LogoutView.as_view(), name='logout'),
    url(r'^api/v1/', include(router.urls)),
    url(r'^api/v1/', include(accounts_router.urls)),
    url('^.*$', IndexView.as_view(), name='index'),
)  + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
示例#7
0
文件: urls.py 项目: DaQingTea/myblog
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

from mysite.views import (IndexView, CategoryView, TagView, PostDetailView,
                          SearchView, AuthorView)
from comment.views import CommentView
from config.views import links

urlpatterns = [
    path('', IndexView.as_view(), name='index'),
    path('category/<int:category_id>/',
         CategoryView.as_view(),
         name='category_list'),
    path('tag/<int:tag_id>/', TagView.as_view(), name='tag_list'),
    path('post/<int:post_id>.html/',
         PostDetailView.as_view(),
         name='post_detail'),
    path('links/', links, name='links'),
    path('search/', SearchView.as_view(), name='search'),
    path('author/<int:owner_id>', AuthorView.as_view(), name='author'),
    path('comment/', CommentView.as_view(), name='comment'),
    path('admin/', admin.site.urls, name='admin'),
]
示例#8
0
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 django.contrib.auth.views import login, logout
from django.conf import settings
from mysite.views import register, HereView, IndexView, showNumber
import restaurants.views
from django.views.generic.base import TemplateView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/login/$', login),
    url(r'^accounts/logout/$', logout),
    url(r'^accounts/register/$', register),
    url(r'^index/$', IndexView.as_view()),
    url(r'^restaurants/', include('restaurants.urls')),
    url(r'^here/$', HereView.as_view()),
    url(r'^shownum99/$', showNumber),
]

if settings.DEBUG:
    urlpatterns += [
        url(r'^test/$', restaurants.views.test),
    ]