This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

More than 3 years have passed since last update.

[Day 40]djangoをサーバにアップする

Last updated at Posted at 2021-02-23

February 23, 2021
←前回:Day 39 djangoで静的ファイルの使用方法

「Djangoを一から学びたい」とのことでありましたら[Day 1]Djangoの開発環境から読むことをおすすめします。

今日やったこと

・requirements.txtの追加
・Procfileの追加
・gitであれこれ
・GitHubにアップロード

requirements.txtとProcfileの追加

requirements.txtとProcfileをdjango_website02の直下に作成します。
中身は以下の通りです。

requirements.txt

django
whitenoise
gunicorn
Procfile

web: gunicorn django_website02.wsgi

ここで、GitHubとHerokuのアカウント設定をしておいてください

gitであれこれ

% git init
% git status
#ここに何かしらでます
#赤字になっているものをaddしていきます
% git add Profile
% git add requirements.txt
#さっき赤字だったものがみどりに変わったかと思います
% git status
% git commit -m 'Add'

GitHubにアップロード

ここは適当に作る
右上のプラスを押して作る

% git remote set-url origin https://github.com/kizashi7512/django-webisite-test02.git
#もし上のものでエラーが出れば
% git remote add origin https://github.com/kizashi7512/django-webisite-test02.git
% git push origin master

おわりに

paizacloudでやるとできるのですが自分のパソコンでやるとできません。
スクリーンショット 2021-02-23 22.07.37.png
これがでます。なぞです。調べてもよくわかりませんでした。

djangoとは関係ないので一旦飛ばします

それではまたまた

←前回:Day 38 毎日続けるために方針を変えました
→次回:Day 41 djangoといろんなデータベースを接続する

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