find_case.py文件: #coding=utf-8 class MyClass(object): def getFileAll(self,request): ...... return HttpResponse('success') urls.py: urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^media/(?Ppath.*)$', serve, {"document_root":
find_case.py文件:
#coding=utf-8class MyClass(object):
def getFileAll(self,request):
......
return HttpResponse('success')
urls.py:
urlpatterns = [url(r'^admin/', admin.site.urls),
url(r'^media/(?P<path>.*)$', serve, {"document_root": MEDIA_ROOT}),
url(r'^api-auth/', include('rest_framework.urls',namespace='rest_framework')),
url(r'^',include(router.urls)),
url(r'^getFileAll$',MyClass().getFileAll,name='getFileAll'),
启动django:
打开浏览器访问:http://127.0.0.1:8000/getFileAll
查看调试日志: