Skip to content

Commit

Permalink
修复上传路径错误
Browse files Browse the repository at this point in the history
  • Loading branch information
liangliangyy committed May 20, 2017
1 parent 12227a4 commit 42f3b46
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions blog/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,9 @@ def fileupload(request):
fname = u''.join(str(filename))

isimage = len([i for i in imgextensions if fname.find(i) >= 0]) > 0
basepath = os.path.join(r'/var/www/resource/' + 'files' if not isimage else'image' + '/',
timestr)

basepath = r'/var/www/resource/{type}/{timestr}'.format(
type='files' if not isimage else'image', timestr=timestr)
url = 'https://resource.lylinux.net/{type}/{timestr}/{filename}'.format(
type='files' if not isimage else'image', timestr=timestr, filename=filename)
if not os.path.exists(basepath):
Expand Down

0 comments on commit 42f3b46

Please sign in to comment.