示例#1
0
from django.conf.urls import url
from django.contrib import admin
from blog.views import baselist, indexlist, LoginView, indexlistview, detailview
from Blog1.settings import STATIC_ROOT
from django.views.static import serve
import xadmin

urlpatterns = [
    url(r'^admin/', xadmin.site.urls),
    url(r'^base/', baselist.basehtml),
    url(r'^home/', indexlist.indexhtml),
    url(r'^login/', LoginView.as_view()),
    # url(r'^register/', LoginView.as_view()),
    url(r'^indexlist/', indexlistview.as_view()),
    url(r'^search/', indexlistview.as_view()),
    url(r'^detail/(?P<blog_id>\d+)/$',
        detailview.as_view(),
        name="blog_detail"),
]
示例#2
0
from django.contrib.auth.views import LogoutView
from django.urls import path

from blog import views
from blog.views import UpdateGroup
from blog.views import UpdateProfile, HomeView, LoginView, UserWorkflow, CreateGroup, GroupDelete

urlpatterns = [
    path('', HomeView.as_view(), name='index'),
    path('panel/login', LoginView.as_view(), name='login'),
    path('panel/logout/', LogoutView.as_view(), name='logout'),
    path('panel/workflow/', UserWorkflow.as_view(), name='workflow'),
    # work with group
    path('panel/group/', views.group, name='group'),
    path('panel/group/delete/<int:pk>/',
         GroupDelete.as_view(),
         name='group-delete'),
    path('panel/group/creategroup', CreateGroup.as_view(), name='creategroup'),
    path('panel/group/<name>/', views.group_detail, name='group_detail'),
    # work with friend
    path('panel/my_profile/<str:slug>',
         UpdateProfile.as_view(),
         name='my_profile-detail'),
    path('panel/group/edit/<int:pk>/',
         UpdateGroup.as_view(),
         name='edit-group'),
    path('panel/users/', views.user_list, name='user_list'),
    path('panel/users/<username>/', views.user_detail, name='user_detail'),
]
示例#3
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, re_path
from django.conf.urls import url
from blog.views import (MainPageView, SignUpView, LoginView, LogoutView,
                        ProfileView, NewPostView, MyDeleteView, PostView,
                        UpdatePostView)
from django.conf.urls.static import static
from django.conf import settings

urlpatterns = [
    path('admin/', admin.site.urls, name='admin'),
    re_path('signup', SignUpView.as_view(), name='signup'),
    re_path('login', LoginView.as_view(), name='login'),
    re_path('logout', LogoutView.as_view(), name='logout'),
    re_path('profile/', ProfileView.as_view(), name='profile'),
    re_path('newpost', NewPostView.as_view(), name='newpost'),
    re_path('posts/(?P<pid>\d+)', PostView.as_view(), name='post'),
    re_path('update_post/(?P<pk>\d+)', UpdatePostView.as_view(),
            name='update'),
    re_path(
        'delete_post/(?P<pk>\d+)', MyDeleteView.as_view(), name='delete_post'),
    url(r'^$', MainPageView.as_view(), name='index'),
    re_path('index', MainPageView.as_view()),
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
示例#4
0
    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.conf import settings
from django.contrib import admin
from blog.views import LentaView, LoginView, logout_view, testview, UserListView, PostListView, \
    MyPostListView, CreatePostView, PostView, DeletePostView, FollowsListView, SubscribeView, \
    UnsubscribeView, PostMarkViewedView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^accounts/login/$', LoginView.as_view(), name='login'),
    url(r'^logout/$', logout_view, name='logout'),
    url(r'^$', LentaView.as_view(), name='lenta'),  # lenta of a logined user
    url(r'^follows/$', FollowsListView.as_view(), name='follows'),
    url(r'^users/$', UserListView.as_view(), name='users'),  # all users
    url(r'^users/(?P<username>[\w.@+-]+)/posts/$',
        PostListView.as_view(),
        name='user'),  # all posts of the user
    url(r'^users/(?P<username>[\w.@+-]+)/subscribe/$',
        SubscribeView.as_view(),
        name='subscribe'),
    url(r'^users/(?P<username>[\w.@+-]+)/unsubscribe/$',
        UnsubscribeView.as_view(),
        name='unsubscribe'),
    url(r'^posts/$', MyPostListView.as_view(),
        name='posts'),  # all posts of a logined user
示例#5
0
文件: urls.py 项目: sdbyrk/project
from django.conf.urls import include, url
from django.contrib import admin
from django.conf.urls.i18n import i18n_patterns
from django.contrib.auth import views
from blog.views import LoginView

urlpatterns = (
    url(r'^admin/', admin.site.urls),
    url(r'^login/$', LoginView.as_view(), name='login'),
    url(r'^accounts/logout/$',
        views.logout,
        name='logout',
        kwargs={'next_page': '/'}),
    url(r'', include('blog.urls')),
)
示例#6
0
文件: urls.py 项目: attichka/potato
from settings import MEDIA_ROOT

from django.conf.urls import patterns, include, url
from django.contrib import admin
admin.autodiscover()

from blog.views import PostsView, PostDetailView, EditPostView, CreatePostView, LoginView

urlpatterns = patterns('',
    url(r"^admin/doc/", include("django.contrib.admindocs.urls")),
    url(r"^admin/", include(admin.site.urls)),
    url(r"^static/(?P<path>.*)$", "django.views.static.serve",
            { "document_root": MEDIA_ROOT }),
    url(r"^$", PostsView.as_view(), name='main'),
    url(r"^post/(?P<slug>[-\w]+)/$", PostDetailView.as_view(), name='post'),
    url(r"^update/(?P<slug>[-\w]+)/$", EditPostView.as_view(), name='update'),
    url(r"^create/$", CreatePostView.as_view(), name='create'),
    url(r'^login/$', LoginView.as_view(), name="login"),
)
示例#7
0
文件: urls.py 项目: mrfuxi/gae-blog
from django.conf.urls.defaults import url, patterns
from blog.views import HomeView, PostListView, PostView, LoginView, AboutMe


urlpatterns = patterns(
    '',
    url(r'^$', HomeView.as_view(), name='home'),
    url(r'^login/$', LoginView.as_view(), {"login": True}, name='login'),
    url(r'^logout/$', LoginView.as_view(), {"login": False}, name='logout'),
    url(r'^blog/$', PostListView.as_view(), name='blog'),
    url(r'^blog/post/$', PostView.as_view(), name='new_post'),
    url(r'^blog/post/(?P<slug>[\w-]+)/$', PostView.as_view(), name='blog_post'),
    url(r'^about_me/$', AboutMe.as_view(), name='about_me'),
)
示例#8
0
from django.conf import settings
from django.conf.urls.static import static
from django.urls import path

from blog.views import LoginView, logout_view
from . import views

urlpatterns = [
    path('', views.index, name='index'),
    path('posts/', views.posts, name='posts'),
    path('new_post/', views.new_post, name='new_post'),
    path("login/", LoginView.as_view(), name="login"),
    path("logout/", logout_view, name="logout"),
    path('register/', views.register, name='register'),
    path('from_old_to_new/',
         views.sort_posts_from_old_to_new,
         name='from_old_to_new'),
    path('from_new_to_old/',
         views.sort_posts_from_new_to_old,
         name='from_new_to_old'),
    path('from_last_24_hours/',
         views.sort_posts_from_last_24_hours,
         name='from_last_24_hours'),
    path('current_user_posts/',
         views.current_user_posts,
         name='current_user_posts'),
]

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
示例#9
0
"""core 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.contrib import admin
from django.urls import path
from django.urls.conf import include

from blog.views import LoginView

urlpatterns = [
    path("admin/", admin.site.urls),
    path("", include("blog.urls")),
    path("login/", view=LoginView.as_view()),
    path("api-auth/", include("rest_framework.urls")),
]
示例#10
0
文件: urls.py 项目: mki/test_dvhb
from django.conf.urls import url

from blog.views import (
    BlogListView, BlogView, FeedView, SubscribeView, ViewedView, PostView, PostAddView,
    LogoutView, LoginView
)


urlpatterns = [
    url(r'^$', BlogListView.as_view(), name='blog_list'),
    url(r'^view/blog/(?P<id>\d+)/$', BlogView.as_view(), name='blog_view'),
    url(r'^view/post/(?P<id>\d+)/$', PostView.as_view(), name='post_view'),
    url(r'^add/$', PostAddView.as_view(), name='post_add'),
    url(r'^subscribe/(?P<id>\d+)/$', SubscribeView.as_view(), name='subscribe_view'),
    url(r'^viewed/(?P<id>\d+)/$', ViewedView.as_view(), name='viewed_view'),
    url(r'^feed/$', FeedView.as_view(), name='blog_feed'),
    url(r'^logout/$', LogoutView.as_view(), name='blog_logout'),
    url(r'^login/$', LoginView.as_view(), name='blog_login'),
]
示例#11
0
    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.views.static import serve  # 模板文件图片解析模块
from settings import MEDIA_ROOT  # 模板文件图片解析路径

from blog.views import BloListView, BloDetailView, RegView, LoginView, LogoutView, IndexView, AddCommentView  #  导入Views函数/类

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^media/(?P<path>.*)$', serve,
        {"document_root": MEDIA_ROOT}),  # 管理媒体文件路径和处理模块
    url(r'^blolist/$', BloListView.as_view(), name="blolist"),  # 博文映射
    url(r'^blodetail/(?P<blog_id>\d+)/$',
        BloDetailView.as_view(),
        name="blodetail"),  # 面经详情映射
    url(r'^ueditor/', include('DjangoUeditor.urls')),  #   增加编辑器映射
    url(r'^register/$', RegView.as_view(), name="register"),  # 用户注册映射
    url(r'^login/$', LoginView.as_view(), name="login"),  # 用户登录页映射
    url(r'^logout/$', LogoutView.as_view(), name="logout"),  # 用户注销映射
    url(r'^$', BloListView.as_view(), name="blolist"),  # 首页映射
    url(r'^addcomment/(?P<blog_id>\d+)/$',
        AddCommentView.as_view(),
        name="addcomment"),  # 用户评论映射
    #    url(r'^$', IndexView.as_view(), name="index"),  # 首页映射
]
示例#12
0
文件: urls.py 项目: ivnnez/blog
from django.conf.urls import patterns, include, url
from blog_system import settings
from blog.feeds import EntradasFeed
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
from blog.views import LoginView

admin.autodiscover()

urlpatterns = patterns('',
                       # url(r'^$', 'django.contrib.auth.views.login',{'template_name':'login.html',name='login'}),
                       # url(r'^cerrar/$', 'django.contrib.auth.views.logout',{'template_name':'login.html',name='login'}),
                       # url de inicio antes de implementar el loggin
                       url(r'login/$', LoginView.as_view(), name='login'),
                       url(r'logout/$', 'blog.views.log_out', name='logout'),
                       url(r'^$', 'blog.views.home', name='home'),
                       url(r'^blogs/(?P<pagina>\d+)/$', 'blog.views.blogs', name='blogs'),
                       url(r'^categorias/(?P<id_categoria>\d+)/$', 'blog.views.categorias', name='categorias'),
                       # url(r'^categorias/$', 'blog.views.categorias', name='categorias'),
                       url(r'^base/$', 'blog.views.base', name='base'),
                       url(r'^demo/$', 'blog.views.demo', name='demo'),
                       # url(r'^blog/(?P<slug>[-\w]+)/$', 'blog.views.blog', name='blog'),
                       url(r'^blog/(?P<id_blog>\d+)/$', 'blog.views.blog', name='blog'),
                       url(r'^busqueda/$', 'blog.views.busqueda', name='busqueda'),
                       #url(r'^comentar/(?P<id_blog>\d+)/$', 'blog.views.comentar', name='comentar'),
                       url(r'^contacto/$', 'blog.views.contacto_view', name='vista_contacto'),
                       url(r'^admin/', include(admin.site.urls)),
                       url(r'^media/(?P<path>.*)$', 'django.views.static.serve',
                           {'document_root': settings.MEDIA_ROOT}),
                       url(r'^feeds/$', EntradasFeed()),
                       url(r'^taggit_autosuggest/', include('taggit_autosuggest.urls')),
示例#13
0
from django.contrib.auth.views import LogoutView
from blog.views import LoginView, HomePageView, RegisterView, PostPageView, \
TagListView, CategoryListView, BlogPageView, AddPostView, UpdatePostView, \
AddCommentView, ReplyCommentView
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.schemas import get_schema_view
from rest_framework_jwt.views import obtain_jwt_token
from blog.api import RegisterUserView, PostViewSet, TagViewSet, \
CategoryViewSet, CommentViewSet, LastTenCommentsViewSet, UserViewSet

urlpatterns = [
    path('', HomePageView.as_view(), name='home'),
    path('add/', csrf_exempt(AddPostView.as_view()), name='add_post'),
    path('blog/', BlogPageView.as_view(), name='blog'),
    path('admin/', admin.site.urls),
    path('login/', csrf_exempt(LoginView.as_view()), name='login'),
    path('logout/', LogoutView.as_view(), name='logout'),
    path('register/', csrf_exempt(RegisterView.as_view()), name='register'),
    path('tag/<str:tag>/', TagListView.as_view(), name='tag'),
    path('post/<int:pk>/', PostPageView.as_view(), name='post'),
    path('category/<str:category>/',
         CategoryListView.as_view(),
         name='category'),
    path('post/<int:pk>/edit/',
         csrf_exempt(UpdatePostView.as_view()),
         name='post_edit'),
    path('post/<int:pk>/addcomment/',
         csrf_exempt(AddCommentView.as_view()),
         name='add_comment'),
    path('reply/comment/<int:id>/',
         csrf_exempt(ReplyCommentView.as_view()),