A curiosity that has been with me for a long time in Django and I never managed to heal:
Next. Let's say I have something like:
from django.shortcuts import render from django.views import View from pagina.models import Config class BasicView(View): try: dados = { 'email': Config.objects.get(variavel = 'email').valor, } except: dados = {} class TelaView(BasicView): def get(self, request, **kwargs): self.template_name = 'base.html' return render(request, self.template_name, self.dados)
Then, in the base.html template, I would call {{email}} and django would show the database in the database.
Now, if I kept the server running and modified the e-mail record in the database, for the new e-mail to appear in the template, it would be necessary to stop the server and run it again.
My question: Why does this happen and how do I get around this?