Following the Django tutorial (part 2), I can't seem to see my Polls app in my django admin panel after registering it. My screen looks a bit like this, with a distinct lack of a section for the Polls app:
What I've done so far (following parts of this answer and the tutorial itself):
- Registered my app in the
admin.pyfile. - Added it to
INSTALLED_APPSinsettings.pyin my project folder. - Ran
python manage.py makemigrations&python manage.py migratewithout any changes (btw, for future readers - that's the new >1.8 incarnation ofsyncdb, I believe). - Made sure the user I'm signing in with has superuser priviliges (as per this answer).
- Restarted my nginx.
I'm still hazy as to what the problem is or, for that matter, how to debug it.
My admin.py file:
from django.contrib import admin
from .models import Question
admin.site.register(Question)
My models.py file (notice the Question object):
import datetime
from django.utils import timezone
from django.db import models
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
def was_published_recently(self):
return self.pub_date >= timezone.now() - datetime.timedelta(days=1)
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
def __str__(self):
return self.choice_text
INSTALLED_APPS portion of my settings.py project file:
INSTALLED_APPS = [
'polls.apps.PollsConfig',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
]
