利用heroku搭建服务的方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/llz62378/article/details/82083092

1. 在heroku网站上注册账号

https://www.heroku.com/

2. 安装heroku CLI

https://devcenter.heroku.com/articles/getting-started-with-python#set-up

3. 用终端登陆heroku

$ heroku login 

输入邮箱和密码


4. 创建一个仓库

下面的命令都是在git bash中执行

git init

git add xxx

git commit -m "myserver"

下面是创建一个heroku仓库,并将自己的代码提交到这个仓库中:

$ heroku create
Creating app... done, floating-sands-17593
https://floating-sands-17593.herokuapp.com/ | https://git.heroku.com/floating-sands-17593.git

$ git push heroku master
Counting objects: 6, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (6/6), 1.68 KiB | 1.68 MiB/s, done.
Total 6 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Python app detected
remote:  !     The latest version of Python 3.6 is python-3.6.6 (you are using python-3.6.0, which is unsupported).
remote:  !     We recommend upgrading by specifying the latest version (python-3.6.6).
remote:        Learn More: https://devcenter.heroku.com/articles/python-runtimes
remote: -----> Installing python-3.6.0
remote: -----> Installing pip
remote: -----> Installing SQLite3
remote: -----> Installing requirements with pip
remote:        Collecting requests>=2.12 (from -r /tmp/build_6c9b905b83df6633ae3bb4c4f833da04/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
remote:        Collecting certifi>=2017.4.17 (from requests>=2.12->-r /tmp/build_6c9b905b83df6633ae3bb4c4f833da04/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/df/f7/04fee6ac349e915b82171f8e23cee63644d83663b34c539f7a09aed18f9e/certifi-2018.8.24-py2.py3-none-any.whl (147kB)
remote:        Collecting urllib3<1.24,>=1.21.1 (from requests>=2.12->-r /tmp/build_6c9b905b83df6633ae3bb4c4f833da04/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/bd/c9/6fdd990019071a4a32a5e7cb78a1d92c53851ef4f56f62a3486e6a7d8ffb/urllib3-1.23-py2.py3-none-any.whl (133kB)
remote:        Collecting idna<2.8,>=2.5 (from requests>=2.12->-r /tmp/build_6c9b905b83df6633ae3bb4c4f833da04/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/4b/2a/0276479a4b3caeb8a8c1af2f8e4355746a97fab05a372e4a2c6a6b876165/idna-2.7-py2.py3-none-any.whl (58kB)
remote:        Collecting chardet<3.1.0,>=3.0.2 (from requests>=2.12->-r /tmp/build_6c9b905b83df6633ae3bb4c4f833da04/requirements.txt (line 1))
remote:          Downloading https://files.pythonhosted.org/packages/bc/a9/01ffebfb562e4274b6487b4bb1ddec7ca55ec7510b22e4c51f14098443b8/chardet-3.0.4-py2.py3-none-any.whl (133kB)
remote:        Installing collected packages: certifi, urllib3, idna, chardet, requests
remote:        Successfully installed certifi-2018.8.24 chardet-3.0.4 idna-2.7 requests-2.19.1 urllib3-1.23
remote:
remote: -----> Discovering process types
remote:        Procfile declares types -> web
remote:
remote: -----> Compressing...
remote:        Done: 55.3M
remote: -----> Launching...
remote:        Released v3
remote:        https://floating-sands-17593.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/floating-sands-17593.git
 * [new branch]      master -> master
 

5. 执行heroku open命令打开部署好的网站。

猜你喜欢

转载自blog.csdn.net/llz62378/article/details/82083092
今日推荐