This commit is contained in:
parent
8d21fc09e3
commit
b28758032f
|
@ -2,6 +2,7 @@ import json
|
|||
from django.http import HttpResponse
|
||||
from myapp.models import *
|
||||
from myapp.utils import get_platform_info
|
||||
from django.core.serializers import serialize
|
||||
|
||||
def _render_json(data):
|
||||
response = HttpResponse(json.dumps(data, ensure_ascii=False),
|
||||
|
@ -10,7 +11,8 @@ def _render_json(data):
|
|||
|
||||
def crawl_info(request):
|
||||
_crawl_info = CrawlInfos.objects.order_by('-id').first()
|
||||
return _render_json(_crawl_info)
|
||||
data = json.loads(serialize('json',[_crawl_info]))[0]
|
||||
return _render_json(data)
|
||||
|
||||
|
||||
def platform_info(request):
|
||||
|
|
|
@ -8,6 +8,6 @@ urlpatterns = [
|
|||
path('crawl', views.crawl, name='crawl'),
|
||||
path('result', views.result, name='result'),
|
||||
path('api/crawl_info.json', apis.crawl_info),
|
||||
path('api/platform_info.json', apis.crawl_info),
|
||||
path('api/platform_info.json', apis.platform_info),
|
||||
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue