Opened 9 years ago
Closed 9 years ago
#25435 closed New feature (wontfix)
Add support for request.urlconf to CurrentSiteMiddleware
Reported by: | Nick Pope | Owned by: | Nick Pope |
---|---|---|---|
Component: | contrib.sites | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
There are a number of situations in which it would be useful to be able to configure request.urlconf
on a per-site basis. In some cases we may have separate sites using the same code base but a different structure of URLs or serving up different content, e.g. a REST API. I have also had to cater for a situation where I needed another version of a site on a different sub-domain with access to a restricted set of URLs that the main site provides.
I have been using the sites framework and propose the addition of a urlconf
field to Site
such that the CurrentSiteMiddleware
can use request.site.urlconf
to set request.urlconf
. This also has the benefit that accessing the site with different Host
headers can result in serving up the different URLconf automatically based on the site that was accessed.
Change History (2)
comment:1 by , 9 years ago
comment:2 by , 9 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
I don't think that your use case is general enough to warrant a new field in the Site model. This looks like a very deployment-specific situation. As for me, the "Djangonic" way of achieving this is to have a combination of settings and your own middleware to do the clever urlconf configuration.
Feel free to discuss that on the django-developers mailing list if you disagree.
PR