#17104: from polls.models import Choice in admin.py
-------------------------------------+-------------------------------------
     Reporter:                       |                    Owner:
  rodrigodelimavieira@…              |  RodrigoJimmy
         Type:  Bug                  |                   Status:  closed
    Component:  Documentation        |                  Version:  1.3
     Severity:  Normal               |               Resolution:
     Keywords:  tutorial, error      |  worksforme
    Has patch:  1                    |             Triage Stage:
  Needs tests:  0                    |  Unreviewed
Easy pickings:  0                    |      Needs documentation:  0
                                     |  Patch needs improvement:  0
                                     |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by carljm):

 * status:  new => closed
 * needs_docs:   => 0
 * resolution:   => worksforme
 * needs_tests:   => 0
 * needs_better_patch:   => 0


Comment:

 `from polls.models import Choice` does work if you've followed the
 tutorial up to that point, and you're running `python manage.py
 runserver`, because the directory containing `manage.py` is added to
 `sys.path`. So you must be doing something else different from the
 tutorial.

 Using `from polls.models import Choice`, as the tutorial does, can cause
 problems when deploying to production, because it often requires adding
 two overlapping paths to `sys.path` in your webserver configuration. This
 issue has already been [http://groups.google.com/group/django-
 
developers/browse_frm/thread/44b70a37ff73298b/0a6836a57eaced1e?lnk=gst&q=cleaning+up#0a6836a57eaced1e
 extensively discussed] and is fixed in trunk (r16964).

 Using a relative import instead of an absolute one (as you are doing) is
 also fine, but you should really make the relative import explicit instead
 of implicit by using `from .models import Choice`.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17104#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to