Django application 504 error after saving model

2019-03-23 05:49发布

I have a Django website running Django 1.8 with Python 3.4 and hosted on AWS via ElasticBeanstalk.

Recently, I've been having some issues with the Django admin area and 504 errors. The problem is very difficult to reproduce, it seems to happen randomly.

When I save an instance of a model, sometimes the website hangs and returns a 504 error (and doesn't save). Afterwhich elasticbeanstalk restarts the server and everything works fine again.

In my logs I get the following errors.

End of script output before headers: wsgi.py

extern "Python": function Cryptography_rand_bytes() called, but @ffi.def_extern() was not called in the current subinterpreter.  Returning 0.

These two errors are repeated multiple times. Can anyone help me figure out how I can debug this?

Thank you!

2条回答
▲ chillily
2楼-- · 2019-03-23 06:08

This error showed up for me by django-ses calling for the rate limit through boto's make_request in the connections module. Reverting cryptography 1.5 to 1.1 fixed my errors.

查看更多
ゆ 、 Hurt°
3楼-- · 2019-03-23 06:26

It is probably due to this bug https://github.com/pyca/cryptography/issues/2299

How to fix discussed here https://github.com/pyca/cryptography/issues/2473

Which seems to say uninstall python Cryptography library and then pip install version 1.1 of it

查看更多
登录 后发表回答