sites.py 729 B

1234567891011121314151617181920212223242526
  1. # -*- coding:utf-8 -*-
  2. # @Time : 2020/5/18 9:54 上午
  3. # @Author : Creat by Han
  4. from django.urls import include, path
  5. from django.conf.urls import url
  6. from smartfarming.api.views import api_gateway, api_document
  7. from django.http import HttpResponseRedirect
  8. class Api(object):
  9. def __init__(self, name="api", app_name="api"):
  10. self.namespace = name
  11. self.app_name = app_name
  12. def get_urls(self):
  13. urlpatterns = [
  14. url(r"^api_gateway", api_gateway, name='api_gateway'),
  15. url(r"^api_document", api_document, name='api_document')
  16. ]
  17. return urlpatterns
  18. @property
  19. def urls(self):
  20. return self.get_urls(), self.app_name, self.namespace
  21. site = Api()