3

I have created a sign in page for my blog, using bootstrap and django. I recently imported crispy forms and when I try and go to the page I get the following error: TemplateDoesNotExist at /register/. However all my redirects and URLs are setup correctly.

On the Django debug it says that the error is in my base HTML file, under the head section where I imported bootstrap CSS. I can provide any code necessary. It says this on my server: django.template.exceptions.TemplateDoesNotExist: bootsrap4.4.1/uni_form.html.

3
  • Do you have some {% include %} statement in your base.html? Commented Feb 20, 2020 at 15:20
  • Are you using the django-bootstrap package by any chance? Commented Feb 20, 2020 at 15:22
  • Did you set your setting CRISPY_TEMPLATE_PACK correctly? it should be something like CRISPY_TEMPLATE_PACK = 'bootstrap4' Commented Feb 20, 2020 at 16:00

5 Answers 5

4

install this version of django-crispy-forms "django-crispy-forms==1.14.0" and your problems will be solved.

Sign up to request clarification or add additional context in comments.

Comments

2

set CRISPY_TEMPLATE_PACK = 'bootstrap4'. Looks like you have it currently set to the full version number.

Comments

1

I encountered similar issue and then realized that it depends on what Bootstrap version you've either installed or which version CDN you're referring to in your template. I used 'bootstrap4' as the CRISPY-TEMPLATE_PACK in my settings.py, but in my base.html template, i'm using Bootstrap5 CDN, therefore Django is not able to retrieve bootstrap4/uni_form.html.

So make sure your template is using the same version of Bootstrap as the one you put in your settings.py.

1 Comment

How do I make sure what version of Bootstrap am I using in the template?
1

Regarding django-crispy-forms templates packs are now in separate package,

depending on the boostrap version you are using, You will need to pip install crispy-bootstrap4 and add crispy_bootstrap4 to your list of INSTALLED_APPS. That will solve your issue

Comments

1

solution:

install crispy-bootstrap4 using the command

pip install crispy-bootstrap4

and then include

crispy_bootstrap4

in the installed apps in settings.py

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.