'Why my own css file is not loading after installation of django-cripsy-form?
I created an website using django (HTML, CSS etc). Everyithing was fine until I wanted to add a login/register form. I used django, templates. But when I installed django-crispy-forms my css was not loading anymore.
Only the register form looks good now but the other stuff like logo, menu, etc are ignoring my css.
That's how I loaded my css and it worked until django-crispy-forms
{% load static %}
<link rel="stylesheet" href="{% static 'css/style.css' %}">
<link rel="stylesheet" href="{% static 'css/bootstrap.min.css' %}">
Only below form looks good due to the django-crispy-forms package.
{% load crispy_forms_tags %}
<div class="container pt-5">
<form method="POST" class="form-group">
{% csrf_token %}
{{ form|crispy }}
<button type="submit" class="btn btn-success">Register </button>
</form>
</div>
Solution 1:[1]
Did you add the "CRISPY_TEMPLATE_PACK" variable in your settings.py? Also make sure you add crispy forms to your installed apps
INSTALLED_APPS = [
...
'crispy_forms',
]
CRISPY_TEMPLATE_PACK = 'bootstrap4'
Learn more about template packs here
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | random person |
