将 Django 应用程序部署到 IBM Bluemix 时出现错误

I got an error when deploy Django appliction to IBM Bluemix

我在将 Django 应用程序部署到 IBM Bluemix 时遇到错误。当我看到日志时,它显示了这个。

2015-09-09T22:08:00.05+0700 [STG/0]      ERR     You are using pip version 6.1.0
.dev0, however version 7.1.2 is available.
2015-09-09T22:08:00.05+0700 [STG/0]      ERR You should consider upgrading via t
he 'pip install --upgrade pip' command.
2015-09-09T22:08:00.28+0700 [STG/0]      OUT -----> Preparing static assets
2015-09-09T22:08:01.02+0700 [STG/0]      OUT        Running collectstatic...
2015-09-09T22:08:01.84+0700 [STG/0]      OUT        175 static files copied to '
/app/static'.
2015-09-09T22:08:17.95+0700 [STG/166]    OUT -----> Uploading droplet (46M)
2015-09-09T22:08:34.18+0700 [DEA/166]    OUT Starting app instance (index 0) wit
h guid a416b8bf-5d53-47d5-9d99-d39c4730cd22
2015-09-09T22:09:03.53+0700 [API/4]      OUT App instance exited with guid a416b
8bf-5d53-47d5-9d99-d39c4730cd22 payload: {"cc_partition"=>"default", "droplet"=>
"a416b8bf-5d53-47d5-9d99-d39c4730cd22", "version"=>"31f9acf2-6bf7-4709-83fd-2ce0
00fa4483", "instance"=>"f4fc8d2f0e4f4bdeb4260fa8cae1f68f", "index"=>0, "reason"=
>"CRASHED", "exit_status"=>2, "exit_description"=>"app instance exited", "crash_
timestamp"=>1441811343}

对于部署应用程序,我有 3 个文件,即 requirements.txt、manifest.yml 和 run.sh 文件。

在我的 manifest.yml 文件中

applications:
- name: RoyalCaninExam
memory: 256M
# This is command provided by cf -c option
command: bash ./run.sh
buildpack: python_buildpack
path: .
services:
- mysql-royalcanin

并在 run.sh 文件中

if [ -z "$VCAP_APP_PORT" ];
  then SERVER_PORT=5000;
  else SERVER_PORT="$VCAP_APP_PORT";
fi

echo [[=12=]] port is------------------- $SERVER_PORT
python manage.py syncdb --noinput
echo "from django.contrib.auth.models import User; User.objects.create_superuser('admin', 'admin@admin.com', 'admin')" | python manage.py shell

echo [[=12=]] Starting Django Server...
python manage.py runserver 0.0.0.0:$SERVER_PORT --noreload

您的 run.sh 脚本似乎不是 运行,因为您的日志中没有输出。请确保您的 run.sh 不包含任何 Windows EOL 编码,因为这会导致 Python buildpack 出现问题。使用您选择的文件编辑器将该文件中的任何 EOL 编码更改为 UNIX。