|
|
@@ -1,3 +1,4 @@
|
|
|
+import traceback
|
|
|
from rest_framework.views import APIView
|
|
|
from rest_framework.response import Response
|
|
|
from django.contrib.auth import authenticate
|
|
|
@@ -85,16 +86,17 @@ class GetWeather(APIView):
|
|
|
|
|
|
if query:
|
|
|
try:
|
|
|
- temp = query.first().content.replace("'", '"')
|
|
|
+ temp = query.first()
|
|
|
+ temp = (temp.content).replace("'", '"')
|
|
|
result = json.loads(temp)
|
|
|
return Response({"content": result, "msg": "success", "code": 200})
|
|
|
except Exception as e:
|
|
|
- logging.info(e)
|
|
|
+ logging.info(traceback.format_exc())
|
|
|
return Response({"msg": "请联系管理员", "code": "50001"})
|
|
|
else:
|
|
|
return Response({"content": "", "msg": "success", "code": 500})
|
|
|
except Exception as e:
|
|
|
- logging.info(e)
|
|
|
+ logging.info(traceback.format_exc())
|
|
|
return Response({"msg": "请联系管理员", "code": "50001"})
|
|
|
|
|
|
|