如何使用django与Elastic Benastalk,它也只能在主节点上通过芹菜运行任务?
django amazon-web-services celery django-celery amazon-elastic-beanstalk
我在 AWS 中有一个运行 Python3.6 (Amazon Linux/2.8.3) 的 ec2 实例,我需要在其中安装 pycurl 和 NSS ssl backend。
pycurl==7.43.0 --global-option="--with-nss"首先,我通过添加到我的文件中进行尝试requirement.txt,但出现错误安装错误。因此,我最终通过添加一个.config文件.ebextensions(在部署期间运行)来完成此操作:
container_commands:
09_pycurl_reinstall:
# the upgrade option is because it will run after PIP installs the requirements.txt file.
# and it needs to be done with the virtual-env activated
command: 'source /opt/python/run/venv/bin/activate && PYCURL_SSL_LIBRARY=nss pip3 install pycurl --global-option="--with-nss" --upgrade --no-cache-dir --compile --ignore-installed'
Run Code Online (Sandbox Code Playgroud)
Pycurl 似乎已正确安装,但 celery 工作程序未运行。芹菜工人日志显示:
__main__.ConfigurationError: Could not run curl-config: [Errno 2] No such file …Run Code Online (Sandbox Code Playgroud)