2016-12-09 42 views
2
gunicorn的Python/Django的崩潰

我已經部署了我的應用程序的Heroku和在加載頁面我得到在日誌中出現以下錯誤:上在Heroku

2016-12-09T22:47:56.020392+00:00 heroku[slug-compiler]: Slug compilation started 
2016-12-09T22:47:56.020401+00:00 heroku[slug-compiler]: Slug compilation finished 
2016-12-09T22:47:56.001478+00:00 heroku[web.1]: State changed from crashed to starting 
2016-12-09T22:48:00.770182+00:00 heroku[web.1]: Starting process with command `gunicorn surfspots.wsgi --log-file -` 
2016-12-09T22:48:03.282956+00:00 heroku[web.1]: Process exited with status 127 
2016-12-09T22:48:03.180446+00:00 app[web.1]: bash: gunicorn: command not found 
2016-12-09T22:48:03.300446+00:00 heroku[web.1]: State changed from starting to crashed 

我正在運行的Python 3.5.2:

$ cat runtime.txt 
python-3.5.2 

我的Django項目的名稱是 'surfspots':

$ cat Procfile 
web: gunicorn surfspots.wsgi --log-file - 

對於this person,他們收到的SA我問題並解決它,因爲他們沒有安裝gunicorn。

不過,我已經gunicorn裝在我requirements.txt,用 「點子安裝gunicorn」

這裏是我的requirements.txt文件:

$ cat requirements.txt 
boto==2.43.0 
click==6.6 
click-plugins==1.0.3 
cligj==0.4.0 
descartes==1.0.2 
dj-database-url==0.4.1 
Django==1.10.4 
django-bootstrap3==7.1.0 
django-geojson==2.9.1 
django-leaflet==0.19.0 
django-storages==1.5.1 
django-tables2==1.2.6 
django-widget-tweaks==1.4.1 
Fiona==1.7.1 
GeoAlchemy2==0.4.0 
gunicorn==19.6.0 
jsonfield==1.0.3 
munch==2.0.4 
numpy==1.11.2 
pandas==0.19.1 
psycopg2==2.6.2 
pyproj==1.9.5.1 
python-dateutil==2.6.0 
pytz==2016.7 
requests==2.12.3 
six==1.10.0 
SQLAlchemy==1.1.4 

這是我的Django的目錄結構項目:

$ tree . -L 2 
. 
├── locations 
│   ├── admin.py 
│   ├── apps.py 
│   ├── data 
│   ├── __init__.py 
│   ├── migrations 
│   ├── models.py 
│   ├── __pycache__ 
│   ├── static 
│   ├── templates 
│   ├── tests.py 
│   └── views.py 
├── manage.py 
├── Procfile 
├── README.md 
├── requirements.txt 
├── runtime.txt 
├── surfspots 
│   ├── __init__.py 
│   ├── __pycache__ 
│   ├── settings.py 
│   ├── urls.py 
│   └── wsgi.py 
└── venv 
    ├── bin 
    ├── include 
    ├── lib 
    └── pip-selfcheck.json 

任何提示?謝謝!

+0

在'runtime.txt'文件中指定了哪個python版本? –

+0

是僅爲您的用戶或系統範圍安裝的gunicon?從bash返回代碼127意味着它無法找到該可執行文件的路徑 - 確保它位於Heroku用戶的PATH中。 (請參閱此處的上下文:http://stackoverflow.com/a/1763178/3276583) – nikobelia

+0

是否將requirements.txt委託給git?你能顯示你的文件結構嗎? –

回答

1

奇怪的是,我的Heroku構建不能訪問gunicorn。但是,我剛剛在this post中看到了一個答案,它提示我遠程卸載所有需求,然後重新安裝它們。這恰好適合我!謝謝大家的及時答覆,非常感謝。