3

I am following the official Django tutorial. I'm stuck in Part 2.

I register the Poll object for admin but never see it. Where do I start to debug and fix this?

I created an admin.py in my polls/ folder:

from polls.models import Poll
from django.contrib import admin

admin.site.register(Poll)
Dizzley
  • 487
  • 6
  • 16
  • 1
    Did you restart the dev server? – Daniel Roseman Jun 03 '11 at 10:45
  • 1
    Is your app added to settings.py? i.e. INSTALLED_APPS = {'Poll',} – Timmy O'Mahony Jun 03 '11 at 10:49
  • I have restarted python (it's on a shared dreamhost server). I can see the admin page fine but no entry for Poll. No 500 error either. – Dizzley Jun 03 '11 at 10:50
  • @pastylegs - ah, I had commented it out. Now I get a 500 error so I will go and debug the Poll code. Let's leave it at that for now. Good calls on a) restart dev server and b) INSTALLED_APPS. – Dizzley Jun 03 '11 at 10:53
  • cool,you should probably close the question if you've got this problem sorted – Timmy O'Mahony Jun 03 '11 at 10:56
  • Cool - (meta) how do I close the question? (Answer my own Q and accept the answer? - In which case, I will do.) – Dizzley Jun 03 '11 at 11:11
  • Yes, it's fine to answer your own question, although, generally that's only for actual solutions to some problem and not just "Oh, found the bug in my code." Still, @Daniel Roseman and @pastylegs comments might still provide useful guidance to someone happening upon this post in the future. – Chris Pratt Jun 03 '11 at 14:38
  • So, if it _was_ a bug, how would I close the question? I'm finding SO clunkier than it ever was. :( See http://meta.stackexchange.com/questions/93749/allowing-users-to-answer-their-own-questions – Dizzley Jun 04 '11 at 07:48

1 Answers1

2

Two good things to check:

  1. Did you restart the dev server?
  2. Is your app added to settings.py? i.e. INSTALLED_APPS = {'Poll',}

If you check the comments on my question you can see how this got resolved. Essentially my problem was that the app was not in INSTALLED_APPS.

Thanks to @Daniel Roseman and @pastylegs

Dizzley
  • 487
  • 6
  • 16