简体   繁体   English

如何在Django中引用不在我的静态文件目录中的静态文件?

[英]How to reference a static file in Django that isn't inside my static file directory?

I want to use a javascript file that isn't in my static URL nor in any file that would be collected when running collect static. 我想使用不在我的静态URL中的javascript文件,也不想在运行collect static时收集的任何文件中使用。 How would a point to this file in a way that I don't have to use {% load static %} 如何以不必使用{%load static%}的方式指向此文件

It is basically so I can have only my DjangoTiny-MCE files in my Heroku server without collecting static instead of storing them in AWS because that has proven troublesome. 基本上我只能在我的Heroku服务器中使用我的DjangoTiny-MCE文件而不收集静态而不是将它们存储在AWS中,因为这已经证明很麻烦。

最简单的方法之一是在某些服务器上托管您的文件,否则有许多可用的免费选项,然后在模板中将该文件用作CDN ,就像其他JS文件链接一样。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM