有谁知道包安装顺序在 Python 中是否重要?更具体地说requirements.txt
,我正在构建的 Django 网站的 pip 是:
Django==1.4
MySQL-python==1.2.3
django-evolution==0.6.7
django-pagination==1.0.7
boto==2.5.2
numpy==1.6.2
requests==0.13.1
simplejson==2.5.2
gunicorn==0.14.6
部署到 Heroku 时,应用程序会崩溃并出现以下错误:
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [12] [INFO] Worker exiting (pid: 12)
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [8] [INFO] Worker exiting (pid: 8)
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Handling signal: term
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [7] [INFO] Worker exiting (pid: 7)
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Starting gunicorn 0.14.6
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Listening at: http://0.0.0.0:20132 (4)
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [4] [INFO] Using worker: sync
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [7] [INFO] Booting worker with pid: 7
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [8] [INFO] Booting worker with pid: 8
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [9] [INFO] Booting worker with pid: 9
2012-08-05T09:26:56+00:00 app[web.1]: 2012-08-05 09:26:56 [10] [INFO] Booting worker with pid: 10
2012-08-05T09:26:57+00:00 heroku[web.1]: State changed from starting to up
2012-08-05T09:26:57+00:00 heroku[web.1]: Process exited with status 143
2012-08-05T09:27:17+00:00 app[web.1]: Usage: gunicorn [options]
2012-08-05T09:27:17+00:00 app[web.1]: gunicorn: error: no such option: --workers
2012-08-05T09:27:17+00:00 app[web.1]:
2012-08-05T09:27:17+00:00 app[web.1]: 2012-08-05 09:27:17 [9] [INFO] Worker exiting (pid: 9)
我Procfile
的地方如下:
web: python manage.py collectstatic --noinput; gunicorn commerical_production.wsgi:application --workers=4 --bind=0.0.0.0:$PORT
只需将要求的顺序更改为:
Django==1.4
gunicorn==0.14.6
MySQL-python==1.2.3
django-evolution==0.6.7
django-pagination==1.0.7
boto==2.5.2
numpy==1.6.2
requests==0.13.1
simplejson==2.5.2
(注意gunicorn
现在移到顶部)
我通过幸运地猜测尝试更改导入的顺序发现了这一点,但我的问题是有没有其他人遇到过这个问题,或者知道为什么包的顺序在从requirements.txt
? 这个问题是否表明我的应用程序中存在一些更大的依赖问题?