将Django应用程序部署到IBM Bluemix

时间:2015-09-09 15:38:14

标签: django ibm-cloud

将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 [$0] 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 [$0] Starting Django Server...
python manage.py runserver 0.0.0.0:$SERVER_PORT --noreload

1 个答案:

答案 0 :(得分:1)

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