4
在requirements.txt
安裝psycopg2,改變了gunicorn==19.0.0
到gunicorn==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安裝缺失的依賴項?我會很感激任何建設性的想法。
我的數據庫設置,如果它是對這一問題感興趣:
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
的安裝?我認爲它不應該。
在Python 3.3中增加'yield from'。 文件「/app/.heroku/python/lib/**python2.7**/site-packages/gunicorn/workers/gaiohttp.py」,第67行 產自self.wsgi.close() – power 2014-09-05 11:53:25
我也注意到它,但它可能會破壞psycopg2?這不是一個棘手的問題嗎?我現在要測試它.. – danbal 2014-09-05 11:54:58
它做了詭計,謝謝@power。如果您將您的評論置於答案中,我會接受它。 – danbal 2014-09-05 12:03:44