gpt4 book ai didi

django - Heroku 未从 requirements.txt 安装 psycopg2

转载 作者:行者123 更新时间:2023-12-01 03:47:24 24 4
gpt4 key购买 nike

已解决

requirements.txt ,更改了 gunicorn==19.0.0gunicorn==18.0.0 ,它做到了。版本 19.0.0 与 Python 2.x 中断,并阻止安装 psycopg2。

原问题

我在 requirements.txt 中有以下内容:

Django==1.6.5
South==0.8.4
argparse==1.2.1
dj-database-url==0.3.0
dj-static==0.0.5
django-toolbelt==0.0.1
gunicorn==19.0.0
psycopg2==2.5.2
pystache==0.5.4
static==1.0.2
wsgiref==0.1.2

但是,当我推送到 Heroku 时,它不会安装 psycopg2 ,甚至没有提到有关此依赖项的任何失败。
Initializing repository, done.
Counting objects: 1257, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (1213/1213), done.
Writing objects: 100% (1257/1257), 504.62 KiB | 376.00 KiB/s, done.
Total 1257 (delta 642), reused 0 (delta 0)

-----> Python app detected
-----> Installing runtime (python-2.7.8)
-----> Installing dependencies with pip
Downloading/unpacking Django==1.6.5 (from -r requirements.txt (line 1))
Downloading/unpacking South==0.8.4 (from -r requirements.txt (line 2))
Downloading/unpacking argparse==1.2.1 (from -r requirements.txt (line 3))
Running setup.py (path:/tmp/pip_build_u3159/argparse/setup.py) egg_info for package argparse

no previously-included directories found matching 'doc/_build'
no previously-included directories found matching 'env24'
no previously-included directories found matching 'env25'
no previously-included directories found matching 'env26'
no previously-included directories found matching 'env27'
Downloading/unpacking dj-database-url==0.3.0 (from -r requirements.txt (line 4))
Downloading dj_database_url-0.3.0-py2.py3-none-any.whl
Downloading/unpacking dj-static==0.0.5 (from -r requirements.txt (line 5))
Downloading dj-static-0.0.5.tar.gz
Running setup.py (path:/tmp/pip_build_u3159/dj-static/setup.py) egg_info for package dj-static

Downloading/unpacking gunicorn==19.0.0 (from -r requirements.txt (line 6))
Running setup.py (path:/tmp/pip_build_u3159/gunicorn/setup.py) egg_info for package gunicorn

Downloading/unpacking pystache==0.5.4 (from -r requirements.txt (line 7))
Running setup.py (path:/tmp/pip_build_u3159/pystache/setup.py) egg_info for package pystache
pystache: using: version '5.4.1' of <module 'setuptools' from '/app/.heroku/python/lib/python2.7/site-packages/setuptools-5.4.1-py2.7.egg/setuptools/__init__.pyc'>

Downloading/unpacking static==1.0.2 (from -r requirements.txt (line 8))
Downloading static-1.0.2.tar.gz
Running setup.py (path:/tmp/pip_build_u3159/static/setup.py) egg_info for package static

Installing collected packages: Django, South, argparse, dj-database-url, dj-static, gunicorn, pystache, static
Running setup.py install for argparse

no previously-included directories found matching 'doc/_build'
no previously-included directories found matching 'env24'
no previously-included directories found matching 'env25'
no previously-included directories found matching 'env26'
no previously-included directories found matching 'env27'
Running setup.py install for dj-static

Running setup.py install for gunicorn

File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/gaiohttp.py", line 67
yield from self.wsgi.close()
^
SyntaxError: invalid syntax

Installing gunicorn_paster script to /app/.heroku/python/bin
Installing gunicorn script to /app/.heroku/python/bin
Installing gunicorn_django script to /app/.heroku/python/bin
Running setup.py install for pystache
pystache: using: version '5.4.1' of <module 'setuptools' from '/app/.heroku/python/lib/python2.7/site-packages/setuptools-5.4.1-py2.7.egg/setuptools/__init__.pyc'>

Installing pystache script to /app/.heroku/python/bin
Installing pystache-test script to /app/.heroku/python/bin
Running setup.py install for static

Installing static script to /app/.heroku/python/bin
Successfully installed Django South argparse dj-database-url dj-static gunicorn pystache static
Cleaning up...

-----> Preparing static assets
Collectstatic configuration error. To debug, run:
$ heroku run python ./manage.py collectstatic --noinput

-----> Discovering process types
Procfile declares types -> web

-----> Compressing... done, 34.7MB
-----> Launching... done, v5

当我尝试 sync数据库,当然,它提示 psycopg2未安装。
如何让 Heroku 安装缺少的依赖项? 我将不胜感激任何 build 性的想法。

我的数据库设置,以防万一这个问题很有趣:
DATABASES = {}
if ENV_TYPE == 'development':
DATABASES['default'] = {'ENGINE': 'django.db.backends.sqlite3',
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),}
else:
DATABASES['default'] = dj_database_url.config()

更新

有一个 SyntaxError报告中提到,为 gunicorn . psycopg2可能是刹车的安装?我认为不应该。

最佳答案

yield from在 Python 3.3 中添加。

File "/app/.heroku/python/lib/**python2.7**/site-packages/gunicorn/workers/gaiohttp.py"‌​, line 67 
yield from self.wsgi.close()

关于django - Heroku 未从 requirements.txt 安装 psycopg2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25685138/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com