Django unread message reminder, same code. Why can we just do it locally. It doesn't work as soon as it's deployed on the server? The code is as follows

clipboard.png

clipboard.png

views.py

clipboard.png

html

{% for notice in notice_list %}
{{notice.id}}
{{ notice.content_object.pub_date|timesince }}
{{notice.sender}}
{% ifequal notice.n_type 1 %}
{{notice.content_object.topic.title}}
{% else %}
{{notice.content_object.topic.title}}
@:
{% endifequal %}
{{ notice.content_object.pub_date|date:"Y-m-d H:i"}}
{% endfor %}


centos django+nginx+uwsgi

:

I simplified the code to this

now it seems that the Notice is not generated or saved
do not know how to debug this on the server? Step by step to see what went wrong?

Mar.31,2022
The

code is too long. Take a glance at it. If you have confirmed that there is nothing wrong with the local test.
you can use django's shell on the server to verify that the send_mail function can send mail successfully.
sometimes the server does not have the ability to send Email by default and needs to be further configured.

Menu