python - 如何调试 DJango 测试服务器提供的错误 500?

标签 python django paypal-ipn internal-server-error

我正在尝试调试我的 DJango Paypal IPN integration但我正在挣扎。 Django 开发服务器向控制台报告 500 错误(但没有其他详细信息),IPN 测试工具报告 500 错误但没有其他详细信息。

我尝试禁用 DEBUG 模式来尝试让它向我发送电子邮件,但尽管将 EMAIL_HOST 设置为合适的内容,但我没有看到任何电子邮件。我尝试通过调用 send_mail 来验证电子邮件系统是否正常工作..但是成功了,我仍然没有看到有关内部服务器错误的电子邮件。

我可能会错过什么?

编辑

我正在从 PyCharm 运行开发服务器,控制台输出如下所示:

runnerw.exe C:\Python26\python.exe manage.py runserver 192.168.1.4:80
Validating models...

0 errors found
Django version 1.4 pre-alpha, using settings 'settings'
Development server is running at http://192.168.1.4:80/
Quit the server with CTRL-BREAK.
Verifying...
...response: VERIFIED
IpnEndPoint.on_process
Valid: {u'last_name': u'Smith', u'txn_id': u'491116223', u'receiver_email': u'<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f98a9c95959c8bb98998808998958a98979d9b9681d79a9694" rel="noreferrer noopener nofollow">[email protected]</a>', u'payment_status': u'Completed', u'tax': u'2.02', u'payer_status': u'unverified', u'residence_country': u'US', u'invoice': u'abc1234', u'address_state': u'CA', u'item_name1': u'something', u'txn_type': u'cart', u'item_number1': u'AK-1234', u'quantity1': u'1', u'payment_date': u'14:03:49 Nov 16, 2011 PST', u'first_name': u'John', u'mc_shipping': u'3.02', u'address_street': u'123, any street', u'charset': u'windows-1252', u'custom': u'xyz123', u'notify_version': u'2.4', u'address_name': u'John Smith', u'address_zip': u'95131', u'test_ipn': u'1', u'receiver_id': u'TESTSELLERID1', u'payer_id': u'TESTBUYERID01', u'mc_handling1': u'1.67', u'verify_sign': u'A8SIYWSxkrwNPfuNewSuxsIAatvMAi2mxYjlYvaiWh3Z4BuIQojK3KBO', u'mc_handling': u'2.06', u'mc_gross_1': u'9.34', u'address_country_code': u'US', u'address_city': u'San Jose', u'address_status': u'confirmed', u'address_country': u'United States', u'mc_fee': u'0.44', u'mc_currency': u'USD', u'payer_email': u'<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="2b495e524e596b5b4a525b4a47584a454f49445305484446" rel="noreferrer noopener nofollow">[email protected]</a>', u'payment_type': u'instant', u'mc_shipping1': u'1.02'}
Logging Transaction..
[16/Nov/2011 22:20:49] "POST /IPN/ HTTP/1.0" 500 104946

最佳答案

要尝试的另一件事是在您的计算机上启动一个简单的 SMTP 服务器。

python -m smtpd -n -c DebuggingServer localhost:1025

这将在您的控制台上输出所有电子邮件标题和正文。 确保 localhost 和端口 1025 分别与您在 settings.py 中的 EMAIL_HOST 和 EMAIL_PORT 相对应。

来源: Djangodocs Testing email sending

关于python - 如何调试 DJango 测试服务器提供的错误 500?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8159414/

相关文章:

paypal - 如何判断退款是通过 API 还是通过常规 Web 界面发出的?

python - Django 休息框架 : using ModelViewSet to get a list of instances by their PKs

django - 如何安全地从模型中删除 ForeignKey 字段?

python - 如何编写基于类的 Django 验证器?

php - 用于 Paypal 的 curl_setopt cacert.pem

python - 在 python 中将稀疏向量添加到稀疏数组太慢

python - 如何将具有 numpy 数组值的 Pandas 系列转换为数据框

python - OpenCV VideoCapture 和 (-215 :Assertion failed) ! _src.empty() 在函数 'cvtColor'

python - 当条件为真时,Pandas 将数据帧拆分为多个

php - Paypal IPN 失败