我部署了我的django項目,並且我的聯繫表格停止了工作。我嘗試了一些在堆棧上找到的技巧,但它不起作用,幫助我PLZ。生產服務器上的smpt django
這裏我的本地設置:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_PORT = 587
EMAIL_HOST_USER = '[email protected]'
EMAIL_HOST_PASSWORD = 'password'
和我的觀點:
def contact_form(request):
form = ContactForm(request.POST or None)
if form.is_valid():
message = form.cleaned_data.get('message')
email = form.cleaned_data.get('email')
subject = 'contact form'
from_email = email
to_email = (settings.EMAIL_HOST_USER,)
contact_message = '%s, from %s' %(message, from_email)
send_mail(subject, contact_message, from_email, to_email, fail_silently=False)
form = ContactForm()
request.session.set_expiry(10)
request.session['pause'] = True
return render(request, 'contact_form.html', {'form':form})
現在,當我發短信我有 「內部服務器錯誤」。
什麼錯誤日誌中說的工作? – doniyor
1分鐘plz,它是我第一次部署。需要了解,我可以在哪裏找到日誌 –
你是如何部署你的應用的? nginx + uwsgi? – doniyor