1👍
✅
You can either do relative URLs in your Javascript, which is probably preferable, or you can define a global variable:
<script>var static_url = '{{ STATIC_URL }}';</script>
<script src="{{ STATIC_URL }}/js/widget.js"></script>
Then, you can use static_url
anywhere in your JS code.
0👍
I would create the STATIC_URL variable in your settings.py file, making it accessible on your entire site.
STATIC_URL = 'https://your.js.server'
- [Answer]-Django Push Notification to IOS
- [Answer]-Django complementary external source authentication
- [Answer]-Alter_column migrations are failing, do I care?
Source:stackexchange.com