Skip to content
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

Feature proposal: djangoStatic service #208

Open
jkosir opened this issue Oct 31, 2015 · 3 comments
Open

Feature proposal: djangoStatic service #208

jkosir opened this issue Oct 31, 2015 · 3 comments

Comments

@jkosir
Copy link
Collaborator

jkosir commented Oct 31, 2015

After the introduction of djangoUrl service we've seen that the current approach might not be best in all cases, but instead 301 MOVED PERMANENTLY would be prefered.

As that doesn't really work with POST we basically have to keep the current approach to ensure all kinds of requests work.

I remember an issue when someone wanted to use djangoUrl for loading of a angular template.html file, somewhere in route configuration. djangoUrl isn't meant for that, rather we would need something like the {% static %} template tag.

So a djangoStatic service, behaving like the {% static %} template tag, this time with 301 MOVED PERMANENTLY responses (the djangoUrl approach wouldn't make do, since static files can be hosted on other servers, say amazon s3).

I think this would make a nice addition, any feedback?

@jrief
Copy link
Owner

jrief commented Oct 31, 2015

Originally I implemented this alternative, but after I've seen that we can't use it for POST requests, I dropped the idea. Probably there is still some code around, just dig though my commits.
However I don't the wording "static", rather I'd prefer something such as "redirect" or "moved to/permanenty/temporarily" or "location" to be more concise with the wording used by HTTP.

Since you will use HTTP code 301 or 302 in my opinion we should use the same wording as they do.

But anyway, yes I like the idea and please proceed with it.

@jkosir
Copy link
Collaborator Author

jkosir commented Oct 31, 2015

I'm pretty sure this should be called djangoStatic as it's a replacement for {% static %} tag and not a redirect version of djangoUrl.reverse().

While we are at that, maybe we could add a redirect version of reverse to djangoUrl, e.g. djangoUrl.reverseRedirect(). On the client side all the code can be reused with only a bit different url.

But it would require developers to make a not-really-necessary choice on which one to use. I'd suggest we put docs about this only as a note at the end of current djangoUrl documentation, if we go for it.

@adrienbrunet
Copy link
Collaborator

Any update @jkosir?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants