Code

Opened 7 years ago

Closed 7 years ago

#5588 closed (duplicate)

wildcard import in urls.py is actually required

Reported by: frank.hoffsummer@… Owned by: nobody
Component: Documentation Version: master
Severity: Keywords: urls.py, docs
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

I just learned the hard way that messing with

from django.conf.urls.defaults import *

in your urls.py can bring about all kinds of weired behaviour. You lose the ability to debug and no errorpages (404, 500 etc) are shown

I made the mistake to change the import to a more explicit one in my urls.py

from django.conf.urls.defaults import patterns, include 

since it was only those two that I needed. big mistake!

it should be noted in the docs somewhere that wildcard import from urls.default is actually required for things to work.

Attachments (0)

Change History (6)

comment:1 Changed 7 years ago by anonymous

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

comment:2 Changed 7 years ago by ubernostrum

Well. Actually it's not required. It's just required that you have a deeper understanding of the names Django expects to find in a root URLConf ;)

Not sure how we should document this, though.

comment:3 Changed 7 years ago by anonymous

See 5350, too.

comment:4 Changed 7 years ago by Thomas Guettler (Home)

See #5350, too

comment:5 Changed 7 years ago by mir

  • Triage Stage changed from Unreviewed to Accepted

I'd say that if you need to import more than your code requires, this must be documented. Users can't be expected to know this a priori ;-)

It could be nicely documented in url_dispatch.txt.

comment:6 Changed 7 years ago by cgrady

  • Resolution set to duplicate
  • Status changed from new to closed

#5350 was the earlier one, and it includes a patch, so it probably should've been the one left open :)

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


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

 
Note: See TracTickets for help on using tickets.