-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
URLConf: fix support for subprojects #8327
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
Conversation
This sounds interesting, but it's non-trivial. We ran into a ton of issues with this in the past, but we might be able to create some better solutions here than we did previously. Knowing the list of languages, versions, and subprojects would make the list of possible URL's workable, but it definitely gets complex pretty fast. We should probably think a bit more how to handle this, because I definitely don't love the current implementation, either :/ |
@stsewd lets discuss this on a call? Perhaps tomorrow? |
just saw this p: but yeah, we can schedule a call |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
@stsewd Adding this one to the roadmap, but let's discuss other possible approaches here, as you noted in the PR description. |
@stsewd @ericholscher isn't this exactly what the new
|
The unresolver still uses django's urlconf, i.e, still tries to guess the project given the URL. |
I'm closing this PR since we are moving forward with a new implementation for proxito. |
We were always exposing the
subproject
part in the custom URLs, that means that we are only serving subprojects,in our proxito URLs we get around that by marking that part as optional with regex.
Here I split the patter into one url patter for the main project and the other for subprojects (we could also maybe hack this to mark it as optional in the regex pattern).
Other couple of fixes I found along the way
/subprojects/None/en/latest
.$subproject/foo
the proxied api endpoint would be generated like//_
There are still more things to fix, like:
/sub/{subproject}
, the main project would be served from/sub/en/latest
), we could have two urlconfs, one for the main project and other for subprojects for further customization.I was also thinking we could go for another implementation.
Instead of relying on the url patterns and their regexes, we could have a catch all paths url pattern (
/anything/that/isn't/the/proxied/api
), then at the view level split the components (anything
,that
, 'isnt', 'the', 'proxied', 'api'), and use the information from the current project being served to identify each component (if the project is single version, what part is the version, the subproject, the language, etc). Like if the project doesn't have subprojects, we know that theprojects
part is part of the path, or if the project doesn't have a translation, etc (avoiding collisions like #8399). This is just an idea, and we wouldn't need to hack our middleware to make it work.