'Django form fields not rendering in template

I am trying to render a simple Django Form on my index page. I have stripped it way back in an attempt to get it to work.

I can display other context elements when passing them in, and I know an instance of the Form is being created (by printing type(form)), it is just empty and I cannot figure out why. I have made similar forms multiple times before without running into this issue.

I have tried rendering as {{ form.as_p }} as well as {{ form }}.

All that renders is the heading, the hidden csrf_token, and the submit button.

Thanks in advance...

from django import forms

class NewPostForm(forms.Form):
    title: forms.CharField(label='Title', max_length=100)
    content: forms.CharField(label='Content', max_length=100)

def index(request):
    form = NewPostForm()
    return render(request, "network/index.html", {
        "form": form
    })
{% block body %}
<div class="new-post">
    <h5>New Post</h5>
    <form action="" method="POST">
        {% csrf_token %}
        {{ form }}
        <input type="submit" value="Add Post">
    </form>
</div>
{% endblock %}


Solution 1:[1]

It should be calling the API's for docker stop against the container on the node where it's running. By default the docker stop will send a SIGTERM followed by a SIGKILL after 10 seconds if the container doesn't gracefully exit. You can see that 10 seconds in commands that don't respond to SIGTERM:

$ cat dc.tail.yml 
version: "3"

services:
  tail:
    image: busybox
    command: "tail -f /dev/null"

$ docker stack deploy -c dc.tail.yml tail
Creating network tail_default
Creating service tail_tail

$ docker service rm tail_tail
tail_tail

$ docker ps -l
CONTAINER ID   IMAGE            COMMAND               CREATED          STATUS          PORTS     NAMES
9e06fbf70708   busybox:latest   "tail -f /dev/null"   16 seconds ago   Up 15 seconds             tail_tail.1.jr4j6sl4oad9fst5qey84rbb0

$ docker ps -l
CONTAINER ID   IMAGE            COMMAND               CREATED          STATUS          PORTS     NAMES
9e06fbf70708   busybox:latest   "tail -f /dev/null"   19 seconds ago   Up 18 seconds             tail_tail.1.jr4j6sl4oad9fst5qey84rbb0

$ docker ps -l
CONTAINER ID   IMAGE            COMMAND               CREATED          STATUS          PORTS     NAMES
9e06fbf70708   busybox:latest   "tail -f /dev/null"   21 seconds ago   Up 20 seconds             tail_tail.1.jr4j6sl4oad9fst5qey84rbb0

$ docker ps -l
CONTAINER ID   IMAGE            COMMAND               CREATED          STATUS          PORTS     NAMES
9e06fbf70708   busybox:latest   "tail -f /dev/null"   23 seconds ago   Up 22 seconds             tail_tail.1.jr4j6sl4oad9fst5qey84rbb0

$ docker ps -l
CONTAINER ID   IMAGE            COMMAND               CREATED          STATUS          PORTS     NAMES
9e06fbf70708   busybox:latest   "tail -f /dev/null"   25 seconds ago   Up 24 seconds             tail_tail.1.jr4j6sl4oad9fst5qey84rbb0

$ docker ps -l
CONTAINER ID   IMAGE            COMMAND               CREATED          STATUS                                PORTS     NAMES
9e06fbf70708   busybox:latest   "tail -f /dev/null"   26 seconds ago   Exited (137) Less than a second ago             tail_tail.1.jr4j6sl4oad9fst5qey84rbb0

The 137 exit code is 128+9, from the SIGKILL (signal 9).

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 BMitch