[英]What is happening when I run `python manage.py test` and on which port the django test server is listening?
I wrote a test for for a signup feature. 我为注册功能编写了一个测试。 When I do manually, the signup process sends email to the user, but when I do it with test script the email is not sent. 当我手动执行操作时,注册过程会将电子邮件发送给用户,但是当我使用测试脚本进行操作时,则不会发送电子邮件。 So I was wondering what is happening inside? 所以我想知道内部正在发生什么?
And what is the port for the test server? 测试服务器的端口是什么? Is there any relation for the test server to send mail with it? 测试服务器与之发送邮件有任何关系吗? Can I specify the test server port? 我可以指定测试服务器端口吗?
manage.py test
doesn't run a "test server" at all, and nothing is listening on any port. manage.py test
根本不运行“测试服务器”,并且任何端口上都没有监听。
Testing emails is fully covered in the docs - as that page shows, you can do from django.core import mail
and then check mail.outbox
. 测试电子邮件已在文档中全面介绍 -如该页面所示,您可以from django.core import mail
,然后检查mail.outbox
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.