[Answer]-Problems with linking to views in Django

1👍

Your TEMPLATE_DIRS settings should look like this:

TEMPLATE_DIRS = (
    os.path.join(BASE_DIR, "templates"),
)

Update

After looking at that screenshot you posted, I can say you’ve made a lot of mistakes.

  1. The templates folder is inside the static folder.

    Move the templates folder out of the static folder.

  2. There’s a mistake in the return statement of your view.

It should look like this:

return render(request, 'pageOne.html')

There’s no need to prepend /static/templates/ to the template name. Django automatically looks for templates in your settings’ TEMPLATE_DIRS path.

And finally, nothing you’re doing is very difficult. All these mistakes are caused by ignorance, since everything is mentioned elaborately in the docs. Please read them carefully.

👤xyres

Leave a comment