urls.py 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. from django.contrib import admin
  2. from django.conf import settings
  3. from django.urls import path, include, re_path
  4. from django.views.generic.base import TemplateView
  5. from django.contrib.staticfiles.views import serve
  6. from django.views.static import serve as static_serve
  7. from drf_spectacular.views import SpectacularAPIView, SpectacularRedocView, SpectacularSwaggerView
  8. from . import views
  9. def return_static(request, path, insecure=True, **kwargs):
  10. return serve(request, path, insecure, **kwargs)
  11. urlpatterns = [
  12. path('admin/', admin.site.urls),
  13. path('', TemplateView.as_view(template_name='dist/spa/index.html')),
  14. path('myip/', views.myip, name='myip'),
  15. path('asn/', include('asn.urls')),
  16. path('dn/', include('dn.urls')),
  17. path('staff/', include('staff.urls')),
  18. path('binset/', include('binset.urls')),
  19. path('binsize/', include('binsize.urls')),
  20. path('binproperty/', include('binproperty.urls')),
  21. path('capital/', include('capital.urls')),
  22. path('driver/', include('driver.urls')),
  23. path('stock/', include('stock.urls')),
  24. path('company/', include('company.urls')),
  25. path('cyclecount/', include('cyclecount.urls')),
  26. path('dashboard/', include('dashboard.urls')),
  27. path('supplier/', include('supplier.urls')),
  28. path('customer/', include('customer.urls')),
  29. path('warehouse/', include('warehouse.urls')),
  30. path('goods/', include('goods.urls')),
  31. path('goodsunit/', include('goodsunit.urls')),
  32. path('goodsclass/', include('goodsclass.urls')),
  33. path('goodscolor/', include('goodscolor.urls')),
  34. path('goodsbrand/', include('goodsbrand.urls')),
  35. path('goodsshape/', include('goodsshape.urls')),
  36. path('goodsspecs/', include('goodsspecs.urls')),
  37. path('goodsorigin/', include('goodsorigin.urls')),
  38. path('scanner/', include('scanner.urls')),
  39. path('payment/', include('payment.urls')),
  40. path('login/', include('userlogin.urls')),
  41. path('register/', include('userregister.urls')),
  42. path('uploadfile/', include('uploadfile.urls')),
  43. path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
  44. re_path(r'^favicon\.ico$', views.favicon, name='favicon'),
  45. re_path('^css/.*$', views.css, name='css'),
  46. re_path('^js/.*$', views.js, name='js'),
  47. re_path('^statics/.*$', views.statics, name='statics'),
  48. re_path('^fonts/.*$', views.fonts, name='fonts'),
  49. re_path(r'^robots.txt', views.robots, name='robots'),
  50. re_path(r'^media/(?P<path>.*)$', static_serve, {'document_root': settings.MEDIA_ROOT}),
  51. re_path(r'^static/(?P<path>.*)$', return_static, name='static')
  52. ]
  53. urlpatterns += [
  54. path('api/', SpectacularAPIView.as_view(), name='schema'),
  55. # Optional UI:
  56. path('api/debug/', SpectacularSwaggerView.as_view(url_name='schema'), name='swagger-ui'),
  57. path('api/docs/', SpectacularRedocView.as_view(url_name='schema'), name='docs'),
  58. ]