Closed jeffjen closed 4 years ago
I had similar problem and inspected into it but found a little simpler solution than yours.
css and js property of Media class is rendered by render_js and render_css method.
When look into that method, it calls absolute_path method to make a path absolute, and absolute_path calls static function, and it calls StaticNode.handle_simple method.
And, this handle_simple
method do the same things you do, turn a path to absolute one with storage.url()
.
So, default django Media logic act like this:
django.contrib.staticfiles
app is installed, get a staticfile_storage
which is defined by settings.STATICFILES_STORAGE
value, and use storage.url(path)
to convert it to absolute.So, I think a simple solution here is that, just to remove any URL prefix and using a relative path.
I close this PR because is solved in #30
Adjust assets management to work with CDN tools like django-storage
python manage.py collectstatic
will upload content to with prefixjson_widget