Wyrzuca mi błąd, że nie potrafi znaleźć pliku index.html
, mimo, że jest w ustawionym folderze.
W settings.py
mam tak ustawione (z poradnika tangowithdjango):
SETTINGS_DIR = os.path.dirname(__file__)
PROJECT_PATH = os.path.join(SETTINGS_DIR, os.pardir)
PROJECT_PATH = os.path.abspath(PROJECT_PATH)
TEMPLATE_PATH = os.path.join(PROJECT_PATH, 'templates')
.....
TEMPLATE_DIRS = (
TEMPLATE_PATH,
)
w błędzie pokazuje tak jak ma być, czyli
TEMPLATE_PATH 'C:\\Users\\Kamil\\Documents\\Django\\mysite\\templates'
views.py (też z poradnika tangowithdjango):
from django.template import RequestContext
from django.shortcuts import render_to_response
def index(request):
# Request the context of the request.
# The context contains information such as the client's machine details, for example.
context = RequestContext(request)
# Construct a dictionary to pass to the template engine as its context.
# Note the key boldmessage is the same as {{ boldmessage }} in the template!
context_dict = {'boldmessage': "I am bold font from the context"}
# Return a rendered response to send to the client.
# We make use of the shortcut function to make our lives easier.
# Note that the first parameter is the template we wish to use.
return render_to_response('index.html', context_dict, context)
jeszcze dołączam dla pewności strukture plików