from django.views.static import serve from apps.users.views import LoginView, LogoutView, DynamicLoginView, RegisterView # from apps.users.views import ActiveUserView,ForgetPwdView from apps.users.views import SendRegEmailView, SendLogEmailView, SendForEmailView from FreeStudy.settings import MEDIA_ROOT from apps.operations.views import IndexView from apps.organizations.views import TeacherListView, TeacherDetailView urlpatterns = [ # path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), path('', IndexView.as_view(), name="index"), path('login/', LoginView.as_view(), name="login"), path('register/', RegisterView.as_view(), name="register"), #注册 path('d_login/', DynamicLoginView.as_view(), name="d_login"), path('logout/', LogoutView.as_view(), name="logout"), url(r'^captcha/', include('captcha.urls')), url(r'^send_reg_email/', csrf_exempt(SendRegEmailView.as_view()), name="send_reg_email"), #邮箱注册验证码发送 url(r'^send_log_email/', csrf_exempt(SendLogEmailView.as_view()), name="send_log_email"), #邮箱登陆验证码发送 # url(r'^send_for_email/', csrf_exempt(SendForEmailView.as_view()), name="send_for_email"),#账号忘记邮箱验证码发送 path('index/', IndexView.as_view(), name="index"), # url(r'^forgetpwd/$', ForgetPwdView.as_view(),name="forget_pwd"),#r'^forgetpwd/$'中的forgetpwd #配置上传文件的访问url url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}), # url(r'^static/(?P<path>.*)$', serve, {"document_root":STATIC_ROOT}),
from django.urls import path from django.conf.urls import url, include import xadmin from Compiler_teaching_platform import settings from django.conf.urls.static import static from django.views.decorators.csrf import csrf_exempt from apps.users.views import LoginView, LogoutView, SendSmsView, DynamicLoginView, RegisterView from django.views.generic import TemplateView urlpatterns = [ path('xadmin/', xadmin.site.urls), path('', TemplateView.as_view(template_name='index.html'), name='index'), url(r'mdeditor/', include('mdeditor.urls')), path('login/', LoginView.as_view(), name='login'), path('register/', RegisterView.as_view(), name='register'), path('dynamiclogin/', DynamicLoginView.as_view(), name='dynamiclogin'), url(r'^captcha/', include('captcha.urls')), path('logout/', LogoutView.as_view(), name='logout'), url(r'^send_sms/', csrf_exempt(SendSmsView.as_view()), name='send_sms'), path('test/', TemplateView.as_view(template_name='test.html'), name='test'), # 课程相关页面 url(r'^course/', include(('apps.courses.urls', 'courses'), namespace='course')), # 操作 url(r'^operation/', include(('apps.operation.urls', 'operation'), namespace='op')), ] if settings.DEBUG:
#注册 path('register/', RegisterView.as_view(),name = "register"), #其别名 # 退出登录 path('logout/', LogoutView.as_view(), name="logout"), # name其别名 #图片验证码 url(r'^captcha/',include('captcha.urls')), # 服务器发送4位短信验证码 url(r'^send_sms/',csrf_exempt(SendSmsView.as_view()),name="send_sms"), #接受验证码的接口 # 接收到验证码、填写验证码、redis是否匹配、如果匹配点击登录 path('d_login/', csrf_exempt(DynamicLoginView.as_view()), name="d_login"), #1、为了整理、上传的图片、我们把所有的上传文件放到media文件夹下面、并且为它创建url访问地址 在setting当中设置两行 151行 152行 #2、设置了setting之后、依然是一个破图、显示不了 #3、配置关于media中图片的访问 #4、r'^media/(?P<path>.*)$' 的意思是取出media文件夹后面的文件把他放到path这个路径当中, #5、server 静态文件的访问url 地址, 这个地址是key:value的形式存储在 Media_root路径下面 url(r'^media/(?P<path>.*)$',serve,{"document_root":MEDIA_ROOT}), # 课程机构 # url(r'^org_list/',OrgView.as_view(), name = 'org_list'), url(r'^org/',include(('apps.organizations.urls',"organizations"),namespace='org')), #用户相关操作
from django.views.generic import TemplateView from django.views.decorators.csrf import csrf_exempt from django.views.static import serve import xadmin from apps.users.views import LoginView, LogoutView, SendSmsView, DynamicLoginView, RegisterView from apps.organizations.views import OrgView from MxOnline.settings import MEDIA_ROOT urlpatterns = [ # path('admin/', admin.site.urls), path('xadmin/', xadmin.site.urls), path('', TemplateView.as_view(template_name='index.html'), name='index'), path('login/', LoginView.as_view(), name='login'), path('d_login', DynamicLoginView.as_view(), name='d_login'), re_path('^logout/$', LogoutView.as_view(), name='logout'), url('^captcha/', include('captcha.urls')), re_path('^send_sms/$', csrf_exempt(SendSmsView.as_view()), name='send_sms'), re_path('^register/$', RegisterView.as_view(), name='register'), # media路由 re_path('^media/(?P<path>.*)$', serve, {'document_root': MEDIA_ROOT}), # 机构相关页面 re_path( r'^org/', include(('apps.organizations.urls', 'organizations'), namespace='org')), ]