5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Django Heroku デプロイ1

Last updated at Posted at 2020-04-18

#前提
フレームワークでDjangoを使用しHerokuでデプロイします。

python-3.7.3
django 2.2

Homebrew・pyenv・Pipenv・Python・Djangoのインストール済み

#Herokuとは
簡単にwebアプリケーションをアップロードして公開できるプラットフォームサービス。
環境構築がすでにできている状態で使えるため、作ったアプリをHerokuでアップロードするだけで簡単にweb上に公開することができる。

#本題
https://signup.heroku.com/jp
上記のURLからHerokuのユーザー登録をします。(無料)

##Heroku Toolbeltの設定
Heroku ToolbeltをインストールすることでHeroku専用のコマンドを使えるようになります。
下記のコマンドをターミナルに入力。(macの場合)

$ brew tap heroku/brew && brew install heroku

※参考サイト
https://devcenter.heroku.com/articles/heroku-cli

##ターミナルからHerokuにログイン
Heroku Toolbeltをインストールしたので、ターミナル上でHerokuのコマンドが使えるようになりました。
では、早速ターミナルからHerokuにログインします。

$ heroku login

heroku: Press any key to open up the browser to login or q to exit: # Enter等押します
Opening browser to https://cli-auth.heroku.com/auth/browser/xxxxxxxxxxxxxxxxxxxxxxxx
Logging in... done
Logged in as sample@example.com # メールアドレスが表示されます

##Herokuでアプリ作成
下記、コマンドでHeroku上でアプリケーションを作成することができます。

$ heroku create アプリ名

【注意!】
アプリ名は、Heroku全体でユニークなものでないと下記のように跳ね返されます!
↓↓例

$ heroku create banban
Creating ⬢ banban... !
 ▸    Name banban is already taken

※例えばこの場合だと、ユニークでないため、跳ね返されます。
そのため、banban-2020など数字をつけるなどしてユニークなものに設定しましょう!

うまくいくと下記のようになります。

$ heroku create banban-2020

Creating ⬢ banban-2020... done
https://banban-2020.herokuapp.com/ | https://git.heroku.com/banban-2020.git

・デプロイ
ここまでで、アプリをデプロイする領域を確保できました。

Herokuへのデプロイは下記に記述しております。
「Django Heroku デプロイ2」
https://qiita.com/yusuke_mrmt/items/a540ba5b04a1fd6dbdb7

5
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
8

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?