urls.py 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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('staff/', include('staff.urls')),
  16. path('login/', include('userlogin.urls')),
  17. path('register/', include('userregister.urls')),
  18. path('stock/', include('stock.urls')),
  19. path('bin/', include('bin.urls')),
  20. path('warehouse/', include('warehouse.urls')),
  21. path('reportcenter/', include('reportcenter.urls')),
  22. # path('asn/', include('asn.urls')),
  23. path('bound/', include('bound.urls')),
  24. path('container/', include('container.urls')),
  25. re_path(r'^favicon\.ico$', views.favicon, name='favicon'),
  26. re_path('^css/.*$', views.css, name='css'),
  27. re_path('^js/.*$', views.js, name='js'),
  28. re_path('^statics/.*$', views.statics, name='statics'),
  29. re_path('^fonts/.*$', views.fonts, name='fonts'),
  30. re_path(r'^robots.txt', views.robots, name='robots'),
  31. re_path(r'^media/(?P<path>.*)$', static_serve, {'document_root': settings.MEDIA_ROOT}),
  32. re_path(r'^static/(?P<path>.*)$', return_static, name='static')
  33. ]