一,部署前的一系列准备:
1、 建立heroku账户
2、 安装Heroku Toolbet工具包
3、 安装第三方包 requirement.txt
4、 Runtime.txt(指定python版本)
5、 设置setting.py
6、 添加Procfile
7、 修改wsgi.py
8、 添加placeholder.txt
二,Git和Heroku的使用
git config --global user.name “名字”
git config --global user.email “邮箱”
表明身份
git init
在项目下面创建一个.git仓库
git add .
添加项目进去仓库
git commit –am “写明标签”
对此次添加说明内容,可自取
Heroku login
登陆heroku
Heroku create
创建app
git push heroku master
推送项目到heroku上
Heroku open
在浏览器里打开项目主页
heroku run python manage.py migrate
创建数据库
——部署基本完成——
——改进部署——
创建超级用户
heroku run bash,进入bash工作区
创建超级用户
python manage.py createsuperuser
关闭工作区
Exit
还有修改setting.py
并且添加404,500 等错误返回的html界面…… OK!