|
@@ -190,7 +190,7 @@ class getAvatarView(TemplateView):
|
|
if filePath == '' or filePath == None:
|
|
if filePath == '' or filePath == None:
|
|
return response.json(800)
|
|
return response.json(800)
|
|
fullPath = os.path.join(BASE_DIR, "static", filePath).replace('\\', '/')
|
|
fullPath = os.path.join(BASE_DIR, "static", filePath).replace('\\', '/')
|
|
- defaultPath = os.path.join(BASE_DIR, "account/getAvatar/User/default.png").replace('\\', '/')
|
|
|
|
|
|
+ defaultPath = os.path.join(BASE_DIR, "static", "User/default.png").replace('\\', '/')
|
|
if os.path.isfile(fullPath):
|
|
if os.path.isfile(fullPath):
|
|
try:
|
|
try:
|
|
Imagedata = open(fullPath, 'rb').read()
|
|
Imagedata = open(fullPath, 'rb').read()
|
|
@@ -198,11 +198,14 @@ class getAvatarView(TemplateView):
|
|
except Exception as e:
|
|
except Exception as e:
|
|
return response.json(906, repr(e))
|
|
return response.json(906, repr(e))
|
|
else:
|
|
else:
|
|
- # try:
|
|
|
|
- # Imagedata = open(defaultPath, 'rb').read()
|
|
|
|
- # return HttpResponse(Imagedata, content_type="image/jpeg")
|
|
|
|
- # except Exception as e:
|
|
|
|
- # return response.json(906, repr(e))
|
|
|
|
|
|
+ print('----------------')
|
|
|
|
+ print(defaultPath)
|
|
|
|
+ print('----------------')
|
|
|
|
+ try:
|
|
|
|
+ Imagedata = open(defaultPath, 'rb').read()
|
|
|
|
+ return HttpResponse(Imagedata, content_type="image/jpeg")
|
|
|
|
+ except Exception as e:
|
|
|
|
+ return response.json(906, repr(e))
|
|
return response.json(907)
|
|
return response.json(907)
|
|
|
|
|
|
|
|
|