1. Question.
According to the official document tutorial of Django project, i meet below problems in the chapter “Advanced tutorial: How to write reusable apps”.
- Install django-polls to MySite as directed.
pip --user install /Users/john/django-polls/dist/django-polls-0.1.tar.gz
- Run Django server after install successfully.
python manage.py runserver
- Browse url http://127.0.0.1:8000/polls/ in a web browser and returns an error.
-
Below is mysite’s setting.py file TEMPLATES section.
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [os.path.join(BASE_DIR, 'templates')], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ]
2. Answer.
- The reason for this error maybe wrong directory or directory does not have the corresponding template file, you can create the template file to fix it.