【发布时间】:2013-09-05 08:43:40
【问题描述】:
我有这样的结构。
~/app/static/ tree -L 2
.
├── css
│ ├── jquery-ui-1.10.3.custom
│ └── styles.css
├── img
│ └── funny
├── js
│ ├── jquery-ui-1.10.3
│ └── jquery-ui-1.10.3.zip
├── privacy-policy.html
└── tou.html
我想向用户展示一个来自 img/funny 的随机文件。 我该怎么做?
我可以在模板中放一个 js 的 css 文件,比如:
<script src="{% static "js/jquery-ui-1.10.3/jquery-1.9.1.js" %}"></script>
但我不知道如何从静态目录的子目录中随机选择一个文件?
【问题讨论】: