django.template.exceptions.TemplateDoesNotExist: bootstrap4/field.html

Am trying to upload my first project on pythonanywhere and i have this problem i dont know exactly what is the issue.



this is my login form because it has to redirect user to login page first

{% extends 'jijiapp/base/base.html' %}
{% load static %}
{% load crispy_forms_tags %}
{% block title %} Upload Item {% endblock %}

{% block content %}

<div class="container">
    <div class="row">
        <div class="col-md-8 mx-auto">
            <h2>Sign in</h2>
            <form method="POST" action="{% url 'login' %}">
                {% csrf_token %}
                <div class="form-group col-md-10 mx-auto">
                    <div class="text-success mx-auto">
                        {% for msgs in messages %}
                            {{ msgs }}
                        {% endfor %}
                    <label class="col-md-5 col-form-label">{{ form.label }}</label>
                    <div class="col-sm-5 form-control ">
                        {{ form.username|as_crispy_field }}
                <div class="form-group col-md-10 mx-auto mb-3">
                    <label class="col-md-5 col-form-label">{{ form.label }}</label>
                    <div class="col-sm-5 form-control ">
                        {{ form.password|as_crispy_field }}
                    {% if form.errors %}
                        <div class="alert alert-danger">
                            <strong>Error:</strong> {{ form.non_field_errors.0 }}
                    {% endif %}
                    <button type="submit" class="btn btn-primary pt-3 px-5">Sign in</button>
                    <p class="">Don't have an account?<a href="{% url 'signup' %}">Signup</a> </p>
                    <p class="">Forget Password<a href="{% url 'password_reset' %}">Reset</a> </p>

{% endblock %}

this is the error from pythonanywhere

  Traceback (most recent call last):
    File "/home/Wilfred7/.virtualenvs/venv/lib/python3.8/site-packages/django/core/handlers/", line 55, in inner
      response = get_response(request)
    File "/home/Wilfred7/.virtualenvs/venv/lib/python3.8/site-packages/django/core/handlers/", line 220, in _get_response
      response = response.render()
    File "/home/Wilfred7/.virtualenvs/venv/lib/python3.8/site-packages/django/template/", line 114, in render
      self.content = self.rendered_content
    File "/home/Wilfred7/.virtualenvs/venv/lib/python3.8/site-packages/django/template/", line 92, in rendered_content
      return template.render(context, self._request)
    File "/home/Wilfred7/.virtualenvs/venv/lib/python3.8/site-packages/django/template/backends/", line 63, in render
      reraise(exc, self.backend)
    File "/home/Wilfred7/.virtualenvs/venv/lib/python3.8/site-packages/django/template/backends/", line 84, in reraise
      raise new from exc
  django.template.exceptions.TemplateDoesNotExist: bootstrap4/field.html

thank you in advance

The error message is very clear (This template ““bootstrap4/field.html”” doesn’t not exist TemplateDoesNotExist ) you have to search in this way
And due to low information, I think you miss installing bootstrap4 or if it installed you forgot to put it in INSTALLEDAPP .
Try to feed us by more info in order to help you

It’s documented here - Installation — django-crispy-forms 2.0 documentation

You need to install the package crispy-bootstrap4.

1 Like

Thank you so much. It realy worked