python - Django到heroku部署问题
问题描述
在尝试部署我的 django 项目时,我遇到了一个奇怪的错误:
有一个我没有使用并卸载的依赖项,它仍在requirements.txt
构建期间尝试加载。
从那以后,我卸载了所有依赖项,将其从requirements.txt
、 runmakemigrations
和中删除migrate
,但它仍然尝试加载它,这会使部署崩溃。
PyGObject
是依赖。
工作流程:Procfile -web: gunicorn solarsystem.wsgi
运行 -pip3 freeze > requirements.txt
卸载后不再显示依赖项。
但是在构建过程中:
Collecting PyGObject
remote: Downloading PyGObject-3.42.0.tar.gz (716 kB)
remote: Installing build dependencies: started
remote: Installing build dependencies: finished with status 'done'
remote: Getting requirements to build wheel: started
remote: Getting requirements to build wheel: finished with status 'done'
remote: Preparing wheel metadata: started
remote: Preparing wheel metadata: finished with status 'done'
...
ERROR: Failed building wheel for PyGObject
...
ERROR: Could not build wheels for PyGObject which use PEP 517 and cannot be installed directly
这是我的requirements.txt
:
asgiref==3.3.4
autopep8==1.5.7
boto3==1.17.108
botocore==1.20.108
click==8.0.1
cm-rgb==0.3.6
cycler==0.10.0
dj-database-url==0.5.0
Django==3.2.3
django-appconf==1.0.4
django-compressor==2.2
django-heroku==0.3.1
django-libsass==0.9
django-material==1.9.0
django-materializecss-form==1.1.17
django-on-heroku==1.1.2
django-sass-processor==1.0.1
gunicorn==20.1.0
hidapi==0.10.1
Jinja2==3.0.1
jmespath==0.10.0
kiwisolver==1.3.1
libsass==0.21.0
MarkupSafe==2.0.1
matplotlib==3.4.3
mpld3==0.5.5
numpy==1.21.2
Pillow==8.3.1
psutil==5.8.0
psycopg2==2.9.1
psycopg2-binary==2.9.1
pycairo==1.20.1
pycodestyle==2.7.0
pyparsing==2.4.7
python-dateutil==2.8.1
pytz==2021.1
PyYAML==5.4.1
rcssmin==1.0.6
rjsmin==1.0.12
s3transfer==0.4.2
six==1.16.0
sqlparse==0.4.1
toml==0.10.2
urllib3==1.26.6
whitenoise==5.3.0
requirements.txt
我已经尝试了和配置的多种变体Procfile
,查看了我的源代码以查找PyGObject
or的任何导入gi
,但没有。我还搜索了PyGObject
文档和其他堆栈溢出资源,但均未成功。
重申一下,我想以某种其他方式完全删除它,或者以某种方式在某处为该依赖项添加一个忽略语句,以便我可以成功部署。
解决方案
matplotlib 使用 PyGobject,这就是为什么它在安装 requirements.txt 文件时尝试安装 PyGobject, https: //pygobject.readthedocs.io/en/latest/ 尝试使用以下命令。它可能会解决安装 PyGobject 的问题
python3 -m pip install --no-use-pep517 cm-rgb
或者
sudo pacman -S python cairo pkgconf gobject-introspection gtk3
pip3 install pycairo to build and install Pycairo
pip3 install PyGObject to build and install PyGObject
推荐阅读
- shiny - 如何使用 req() 和 shinyjs 切换功能来启用/禁用元素?
- phpunit - Phpunit 代码覆盖率没有捕获我的代码
- java - 如何映射复合键,其中一个是使用 Hibernate 的外键
- javascript - requestAnimationFrame 递归调用自己,怎么可能触发一次动画结束事件?
- vba - 如何替换 vba 无法识别的值?
- c# - 软件加载项上的数字签名
- python - BeautifulSoup 和 Python Lambda
- wso2 - 证书中的 wso2 esb 分析主机名不匹配:
!= - python - 如何将 Python 字典转换为 Newick 表单格式?
- php - 如何将字符串转换为浮点数,然后在 PHP 中的多维数组中按升序对数字进行排序?