New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support URLs that don't start with /static/
#177
Comments
Hi @krallin, Do you have an opinion on what approach you'd prefer? Should I hack the template tag or implement it as a new tag/plugin? Or should I just make a concrete implementation which you then can review? Of course I could just hack something for our use case, but I imagine a solution for this could be useful for more people and I'd like to contribute it back to cactus and want to ensure I at last start working in the "right" direction. Thanks a lot for your time & consideration! Cheers! |
Hey @nureineide, I'm sorry, I haven't really had time to look at this (but I'll try and do so this weekend). I wish I could give you a quick and straightforward answer but the truth is I don't really recall whether I knew how to address the problem when I wrote the TODO. Generally speaking regarding editing existing functionality vs. building something new:
Hope this helps! I'll try and follow up as I can. Cheers, |
Yes, this helps & is enough for now. I can take a stab from here and publish what I did. You then can decide if you'd like to integrate it at some point. Thanks a lot for your quick response! |
I found a hacky way to do this. Simply include a |
is there any news on this ? because it's really a blocker for running it in gitlab or other sites like this |
We went the route of implementing a simple plugin, that reads an optional The following is the plugin code, which you are free to use as is. import os
from cactus import config
INFO = {
'name': 'CUSTOM_STATIC_URL',
'description': 'Set STATIC_URL to value from config.json in project dir'
}
STATIC_URL_KEY = 'static_base_url'
conf = config.Config('config.json')
def preBuildPage(site, path, context, data):
if conf.get(STATIC_URL_KEY):
context.update({ 'STATIC_URL': conf.get(STATIC_URL_KEY) })
else:
context.update({ 'STATIC_URL': '/static' })
return context, data ... and a sample {
"static_base_url": "https://cdn.example.com/somepath"
} I'll close this issue, as I'll not put any further work into it. Sorry, for keeping it open for so long, without any update. |
The plugin does not work with the |
In
template_tags.py#L19
aTODO
says exactly that.I'd like to tackle this one, as we need it in one of our projects.
Do you have any hints on how to do this? Introduce a config setting, and if present use that as a base url for static assets? Did you have any concrete plans/ideas on how to implement this?
I wonder if it would be a good idea to reuse django's
STATIC_ROOT
related capabilities (or rather thecollectstatic
contrib to be exact) for that.But this would somehow contradict the item on the roadmap (see #117) which states/asks, that other template engines than Django's would be a nice feature.
The text was updated successfully, but these errors were encountered: