I have my Django static files in Amazon Servers, and I trying to load these files in my Model Admin File, but its only work with absolute URLs.
In my Django templates I load and call my static files with
{% load admin_static %}
<script type="text/javascript" src="{% static "js/myfile.js" %}"></script>
in settings.py i set this
STATIC_URL = 'https://s3.mydomain.com/static/'
and in my Model Admin, in moment, it only works with
class Media:
js = ("https://s3.mydomain.com/static/myfile.js",
"https://s3.mydomain.com/static/myfile2.js",)
How can I load these files only with the static file name? I trying
class Media:
js = ("{% static "js/myfile.js" %}",
"{% static "js/myfile2.js" %}",)
but doesn't work.
How about this:
In your settings file:
STATIC_URL = "https://aws.domain.com/"
It is standard settings . Note , that it must end in a slash if set to a non-empty value.
from django.conf import settings
class Media:
js = (settings.STATIC_URL + "js/myfile.js",
settings.STATIC_URL + "js/myfile2.js")
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.