[Answer]-Django forms can't find my template

2👍

Ensure your template loaders are configured in your settings.py;

TEMPLATE_LOADERS = (
    'django.template.loaders.filesystem.Loader',
    'django.template.loaders.app_directories.Loader',
)

It appears you’ve placed your template into your app’s template directory and namespaced it with the app name. You should include the namespace (your app name) in the call to render.

return render(request, 'showCrime/getQuery.html', {'form': qform})

-1👍

together with @andrewS’s hint about the showCrime/ prefix in the call to render(), i was able to fix this by following the suggestion in Chap7 of the Django book of using an empty string in the HTML: <form action="" method="post">. there seems some django sensitivity to trailing slashes, etc. that remains beyond me, but this works!

👤rikb

Leave a comment