Esempio n. 1
0
import xadmin

from apps.users.views import IndexView, LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyPwdView
from apps.users.views import LogOutView
from django.views.static import serve
from mydjango1.settings import MEDIA_ROOT

urlpatterns = [
    path('xadmin/', xadmin.site.urls),
    path('', IndexView.as_view(), name='index'),
    path('login/', LoginView.as_view(), name='login'),
    path('logout/', LogOutView.as_view(), name='logout'),
    path('register/', RegisterView.as_view(), name='register'),
    path("captcha/", include('captcha.urls')),
    # 激活用户url
    re_path('active/(?P<active_code>.*)/', ActiveUserView.as_view(), name='user_active'),
    # 忘记密码
    path('forget/', ForgetPwdView.as_view(), name='forget_pwd'),
    re_path('reset/(?P<active_code>.*)/', ResetView.as_view(), name='reset_pwd'),
    path('modify_pwd/', ModifyPwdView.as_view(), name='modify_pwd'),

    # 课程机构
    path('org/', include('oragnization.urls', namespace='org')),
    # 公开课
    path('cou/', include('course.urls', namespace='cou')),
    # 用户中心
    path('user/', include('users.urls', namespace='user')),

    # 访问静态文件的处理view
    re_path('media/(?P<path>.*)', serve, {'document_root': MEDIA_ROOT}),
    # re_path('static/(?P<path>.*)', serve, {'document_root': STATIC_ROOT}),
Esempio n. 2
0
File: urls.py Progetto: yyx2831/mkw
    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.views.generic import TemplateView  # TemplateView可以不用自己写跳转view也可以完成跳转
from apps.users.views import LoginView, RegisterView, ActiveUserView, ForgetPwdView, ResetView, ModifyOowdView
import xadmin

# TemplateView自带的view不用自己写跳转view也可以完成跳转
urlpatterns = [
    url(r'^admin/', xadmin.site.urls),
    url('^$', TemplateView.as_view(template_name="index.html"),
        name='index'),  # 使用django自带的TemplateView做跳转
    # url('^login/$', LoginView, name='login'),     # 自己写的跳转
    url('^login/$', LoginView.as_view(), name='login'),  # 登陆
    url('^register/$', RegisterView.as_view(), name='register'),  # 注册
    url(r'^captcha/', include('captcha.urls')),  # 验证码
    # 邮箱激活,解析出url aactive 后面为了验证生成的乱码, 这里<>可以随意写后面要用这个名字调用, 使用正则表达式解析的
    url(r'^active/(?P<active_code>.*)/$',
        ActiveUserView.as_view(),
        name="user_active"),
    url(r'^forget/$', ForgetPwdView.as_view(), name='forget_pwd'),
    url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(),
        name="reset_pwd"),
    url(r'^modify_pwd/$', ModifyOowdView.as_view(), name='modify_pwd'),
]
Esempio n. 3
0
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""

from django.conf.urls import url, include
from django.views.generic import TemplateView
from django.views.static import serve
import xadmin

from apps.users.views import LoginView, RegisterView, ActiveUserView, \
    ForgetPwdView, ResetView, ModifyPwdView
from apps.organization.views import OrgView
from settings import MEDIA_ROOT

urlpatterns = [
    url(r'^xadmin/', xadmin.site.urls),
    url('^$', TemplateView.as_view(template_name="index.html"), name="index"),
    url('^login/$', LoginView.as_view(), name="login"),
    url('^register/$', RegisterView.as_view(), name="register"),
    url(r'^captcha/', include('captcha.urls')),
    url(r'^active/(?P<active_code>.*)/$', ActiveUserView.as_view(), name="user_active"),
    url(r'^reset/(?P<active_code>.*)/$', ResetView.as_view(), name="reset_pwd"),
    url(r'^forget/$', ForgetPwdView.as_view(), name="forget_pwd"),
    url(r'^modifypwd/$', ModifyPwdView.as_view(), name="modify_pwd"),

    # 课程机构首页
    url(r'^org_list/$', OrgView.as_view(), name="org_list"),

    # 处理静态文件,上传文件的访问处理
    url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT})
]