从Apache服务器运行而不是从Django开发服务器

时间:2017-03-14 15:31:23

标签: python django python-requests

当我在生产'生产'中运行Django应用程序的网站运行('bad handshake: SysCallError(0, None)',)时,我收到以下错误response = requests.get(film_url) (即Apache2网络服务器)。

当我使用Django开发服务器从笔记本电脑运行系统时,我没有收到此错误。 film_url是RottenTomatoes.com上电影(可能是任何电影)的链接,例如https://www.rottentomatoes.com/m/myfilm

我正在运行python 2.7,我认为这是一个SSL问题,但我不知道如何排序。我试图遵循这个advice,但我在尝试安装pyOpenSSL时遇到错误,即:

Command "/var/www/mga/env/bin/python2 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-DuLMZe/cryptography/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-giimpi-record/install-record.txt --single-version-externally-managed --compile --install-headers /var/www/mga/env/include/site/python2.7/cryptography" failed with error code 1 in /tmp/pip-build-DuLMZe/cryptography/

1 个答案:

答案 0 :(得分:0)

我找到了答案here,它基本上说由于服务器资源不足而导致此错误。

解决方案是:

sudo dd if=/dev/zero of=/swapfile bs=1024 count=524288
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile