Django项目部署到Heroku Demo要注意的事项
1. 复制一份项目, 用于修改并部署到Heroku. 删除.git文件夹, virtualenv文件夹.
2. 进入复制的项目, git init
3. 添加 .env 到 .gitignore
4. git commit
5. heroku create
6. git remote -v
将会有类似的输出(.git前面的字符用于下一步): heroku https://git.heroku.com/falling-wind-1624.git (fetch)
7. heroku git:remote -a falling-wind-1624
8. git push heroku master
```
pip freeze > requirements.txt
Add Procfile
install gunicorn
install whitenoise to serve static files
add app domain to ALLOWED_HOSTS
don't overwrite server database (local move out, git commit, .gitignore, move in, push)
git push heroku master
heroku logs --source app --tail
```
2. 进入复制的项目, git init
3. 添加 .env 到 .gitignore
4. git commit
5. heroku create
6. git remote -v
将会有类似的输出(.git前面的字符用于下一步): heroku https://git.heroku.com/falling-wind-1624.git (fetch)
7. heroku git:remote -a falling-wind-1624
8. git push heroku master
```
pip freeze > requirements.txt
Add Procfile
install gunicorn
install whitenoise to serve static files
add app domain to ALLOWED_HOSTS
don't overwrite server database (local move out, git commit, .gitignore, move in, push)
git push heroku master
heroku logs --source app --tail
```
评论
发表评论