Django Book 翻译
菜单>:
TOC
返回
原文:
For example, say your ``MEDIA_ROOT`` is set to ``'/home/media'`` , and ``upload_to`` is set to ``'photos/%Y/%m/%d'`` . The ``'%Y/%m/%d'`` part of ``upload_to`` is strftime formatting; ``'%Y'`` is the four-digit year, ``'%m'`` is the two-digit month, and ``'%d'`` is the two-digit day. If you upload a file on January 15, 2007, it will be saved in the directory ``/home/media/photos/2007/01/15`` .
翻译:
例如,你的 ``MEDIA_ROOT`` 设置为 ``'/home/media'`` , ``upload_to`` 设置为 ``'photos/%Y/%m/%d'`` 。其中 ``'%Y/%m/%d'`` 部分是日期格式化串: ``'%Y'`` 为4位的年份, ``'%m'`` 是两位月份, ``'%d'`` 是两位的日期。如果你在2007年1月15日上传文件,这个文件就会被保存在 ``/home/media/photos/2007/01/15`` 目录下。
备注:
译者: