在Django中将两个目录设为静态 [英] Make two directories static in django

查看:250
本文介绍了在Django中将两个目录设为静态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个目录。
static包含javascript和CSS文件。在设置中,我写了 STATIC_URL ='/ static /',因此正确包含了它们。

I have two directories. static contains javascript and css files. In settings I wrote STATIC_URL = '/static/' so they are included correctly.

但是我也有文件夹有很多图像的图像。
我的问题是如何不能使文件夹图像也变为静态图像,因为我无法复制到静态图像中。

But also I have folder images which has pretty many images. My question how can I make folder images also static, because I can't copy into into static.

谢谢。

推荐答案

它看起来像 STATICFILES_DIRS 可以采用多种路径:

it looks like STATICFILES_DIRS can take multiple paths:

STATICFILES_DIRS = (
    os.path.join(BASE_DIR, "static"),
    '/var/www/static/',
)

这篇关于在Django中将两个目录设为静态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆