Code

Opened 6 years ago

Last modified 3 years ago

#8952 new New feature

Refactor a Django "site" to be just another view function

Reported by: simon Owned by: nobody
Component: contrib.sites Version: 1.0
Severity: Normal Keywords: djangocon
Cc: Triage Stage: Someday/Maybe
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

At the moment middleware applies globally (unless you use the decorator_from_middleware hack). A Django powered site is essentially a thing that takes an HTTP request and returns an HTTP response. We should refactor things a bit so the highlest level of a Django site is just another view, which can compose bits of middleware and a URL dispatcher. This way Django applications end up composed of nested view functions, URL dispatchers and middleware which is really elegant. It won't be easy to do this due to lots of existing code expecting things to be how they are at the moment, but it's worth investigating.

Attachments (0)

Change History (7)

comment:1 Changed 6 years ago by simon

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Getting reverse to work will be really hard.

comment:2 Changed 5 years ago by jacob

  • Triage Stage changed from Unreviewed to Design decision needed

comment:3 Changed 5 years ago by thejaswi_puthraya

  • Component changed from Uncategorized to Contrib apps

comment:4 Changed 3 years ago by gabrielhurley

  • Component changed from Contrib apps to contrib.sites

comment:5 Changed 3 years ago by lukeplant

  • Severity set to Normal
  • Type set to New feature

comment:6 follow-up: Changed 3 years ago by aaugustin

  • Easy pickings unset
  • Triage Stage changed from Design decision needed to Someday/Maybe
  • UI/UX unset

I'm not sure if it's useful to keep this ticket open after three years. Several paradigms have shifted since then.

comment:7 in reply to: ↑ 6 Changed 3 years ago by carljm

Replying to aaugustin:

I'm not sure if it's useful to keep this ticket open after three years. Several paradigms have shifted since then.

FWIW I think this is a really good idea - I don't see anything that's shifted that would make this inapplicable. It'd be one (significant) step towards reducing the dependency on global settings everywhere.

I'm not in favor of closing this ticket, but Someday/Maybe is an appropriate state for it. I'd be happy to upgrade it to Accepted, though, if someone came along who was serious about working on it :-)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as new
The owner will be changed from nobody to anonymous. Next status will be 'assigned'
as The resolution will be set. Next status will be 'closed'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.