Fahim Hussain
Fahim Hussain

Reputation: 31

AttributeError -Settings' object has no attribute 'CRISPY_TEMPLATE_PACK'

I am trying to buildtodo list webapp in django. when i try to run 'python manage.py runserver' but am receiving this error AttributeError: 'Settings' object has no attribute 'CRISPY_TEMPLATE_PACK' Any help on how to fix this and get my localhost running?

CRISPY_TEMPLATE_PACK

Upvotes: 3

Views: 9385

Answers (2)

Ed_
Ed_

Reputation: 1117

I was upgrading crispy-bootstrap5 from prior 0.7 version to 2024.10 with matching django-crispy-forms==2.3, and what I did was to specify which framework version for the front-end to use in settings.py per the documentation:

CRISPY_ALLOWED_TEMPLATE_PACKS = "bootstrap5"

CRISPY_TEMPLATE_PACK = "bootstrap5"

Upvotes: 1

SamuelOsondu
SamuelOsondu

Reputation: 129

I guess you're trying to use the Django Crispy package latest release (2.0). If that's the case, you might likely encounter that challenge. To fix it:

  1. First include this in your settings.py

    CRISPY_TEMPLATE_PACK = 'bootstrap4'

  2. After doing that you might encounter a challenge that the template does not exist. If that occurs, make sure you have crispy-bootstrap installed - pip install crispy-bootstrap4 and add 'crispy_bootstrap4' to your list of INSTALLED_APPS.

Upvotes: 13

Related Questions