published: {{ post.published_date }}
+{{ post.title }}
{{ post.text|linebreaksbr }}
-diff --git a/.github/list_languages b/.github/list_languages new file mode 100755 index 00000000000..27ee2e7999e --- /dev/null +++ b/.github/list_languages @@ -0,0 +1,35 @@ +#!/usr/bin/env python3 + +import argparse +import json +import os +from pathlib import Path + + +def parse_langs(langs, include_beta): + for line in langs.readlines(): + description = line[3:-7] + code = line[-5:-3] + + if include_beta or 'beta' not in description: + yield code, description + +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('--include-beta', help='Include beta languages', default='false', + choices=('true', 'false')) + parser.add_argument('--langs-file', help='LANGS.md to use', + type=argparse.FileType('r', encoding='UTF-8'), + default=(Path(__file__).absolute().parent.parent / 'LANGS.md').as_posix()) + args = parser.parse_args() + + languages = dict(parse_langs(args.langs_file, args.include_beta == 'true')) + + if 'GITHUB_ACTION' in os.environ: + print(f'::set-output name=languages::{json.dumps(list(languages.keys()))}') + for code, language in languages.items(): + print(f'{language} ({code})') + + +if __name__ == '__main__': + main() diff --git a/.github/workflows/translations.yml b/.github/workflows/translations.yml new file mode 100644 index 00000000000..434e1f1aa4e --- /dev/null +++ b/.github/workflows/translations.yml @@ -0,0 +1,54 @@ +name: Update translations + +on: + workflow_dispatch: + inputs: + include_beta: + type: boolean + default: false + description: Include beta languages + +env: + GIT_AUTHOR_NAME: Django Girls Automation + GIT_AUTHOR_EMAIL: automation@djangogirls.org + +jobs: + list_languages: + name: List languages + runs-on: ubuntu-latest + outputs: + languages: ${{ steps.set_list.outputs.languages }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set the language list + id: set_list + run: ./.github/list_languages --include-beta ${{ inputs.include_beta }} + + update_language: + name: 'Update ${{ matrix.language }} translations from Crowdin' + needs: list_languages + if: ${{ needs.list_languages.outputs.languages != '[]' }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + language: ${{ fromJson(needs.list_languages.outputs.languages) }} + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Update language + run: | + wget https://crowdin.com/backend/download/project/django-girls-tutorial/${{ matrix.language }}.zip + unzip ${{ matrix.language }}.zip + find ${{ matrix.language }} -name '*.md' -delete + rsync -av master/${{ matrix.language }}*/* ${{ matrix.language }}/ + rm -rf ${{ matrix.language }}.zip master + - name: Open a PR + uses: peter-evans/create-pull-request@v3 + with: + commit-message: "Update ${{ matrix.language }} translations from Crowdin" + branch: "update_translations/${{ matrix.language }}" + title: "Update ${{ matrix.language }} translations from Crowdin" + body: '' + delete-branch: true diff --git a/ja/README.md b/ja/README.md index 165147d1c7e..7da60a87851 100644 --- a/ja/README.md +++ b/ja/README.md @@ -2,13 +2,13 @@ [](https://gitter.im/DjangoGirls/tutorial) -> これは、Creative Commons Attribution-ShareAlike 4.0 International License のライセンスの下で提供しています。ライセンスについてはこちらをご確認ください。 https://creativecommons.org/licenses/by-sa/4.0/ +> これは、Creative Commons Attribution-ShareAlike 4.0 International License のライセンスの下で提供しています。ライセンスについてはこちらをご確認ください。 https://creativecommons.org/licenses/by-sa/4.0/deed.ja ## ウェルカム! -Django Girlsのチュートリアルにようこそ! お会いできて嬉しいです :) このチュートリアルでは、ウェブテクノロジーの中身を見て回る旅へあなたをお連れします。私たちが知っているようにウェブを動かすのに必要なものすべてを垣間見ることができるでしょう。 +Django Girlsのチュートリアルにようこそ! ここでお会いできてうれしいです :) このチュートリアルでは、ウェブテクノロジーの内側を見るたびにお連れします。私たちが知っているように、ウェブを動かすのに必要な技術を垣間見ることができるでしょう。 -知らないことを学ぶことは冒険のようなものです - でも心配はいりません。あなたはすでに勇気を出してここにいらっしゃるのですから、きっとうまくいくでしょう :) +全てが知らないことのように、これは冒険のようになるでしょう。けれど心配しないでください。あなたはすでに勇気をだしてここにいるのですから。上手くいくでしょう :) ## はじめに diff --git a/ja/SUMMARY.md b/ja/SUMMARY.md index 8a92ce208be..8f99cd0d28f 100644 --- a/ja/SUMMARY.md +++ b/ja/SUMMARY.md @@ -8,8 +8,8 @@ * [仮想環境](installation/README.md#virtualenv) * [Django](installation/README.md#django) * [Git](installation/README.md#git) - * [GitHub](installation/README.md#github) - * [PythonAnywhere](installation/README.md#pythonanywhere) + * [GitHub](installation/README.md#github-account) + * [PythonAnywhere](installation/README.md#pythonanywhere-account) * [Chromebookのセットアップ](chromebook_setup/README.md) * [インターネットのしくみ](how_the_internet_works/README.md) * [コマンドラインを使ってみよう](intro_to_command_line/README.md) diff --git a/ja/chromebook_setup/README.md b/ja/chromebook_setup/README.md index ff6832e668e..abcc0c7ed87 100644 --- a/ja/chromebook_setup/README.md +++ b/ja/chromebook_setup/README.md @@ -1,5 +1,5 @@ # Chromebook のセットアップ -> **注意**既にインストール手順を実行している場合は、これをやり直す必要はありません。すぐにスキップして[ Python入門](../python_introduction/README.md)へ進んでください。 +> **注意** 既にインストール手順1>を実行しているのなら再び行う必要はありません。スキップして[Python入門](../python_introduction/README.md)に進んでください。 {% include "/chromebook_setup/instructions.md" %} \ No newline at end of file diff --git a/ja/chromebook_setup/instructions.md b/ja/chromebook_setup/instructions.md index 92824b85a5b..fe7ec6824d2 100644 --- a/ja/chromebook_setup/instructions.md +++ b/ja/chromebook_setup/instructions.md @@ -1,8 +1,8 @@ Chromebookを使わない場合は、このセクションを飛ばして、[Pythonのインストール](http://tutorial.djangogirls.org/en/installation/#install-python) に進んでください。 もし利用している場合は、普通のインストールの作業とは少し異なります。 インストール手順の残りの部分は無視できます。 -### クラウドIDE (PaizaCloud Cloud IDE, AWS Cloud9) +### クラウドIDE (PaizaCloud Cloud IDE, AWS Cloud9, Glitch.com) -クラウドIDEはコードエディタと、インターネットにつながって動作し、ソフトウェアをインストールしたり、書いたり、実行したりできるコンピュータへのアクセスを提供するツールです。 チュートリアルを通して、クラウドIDEはまるであなたの*ローカルマシン*のように動作するでしょう。 みんながOS XやUbuntuやWindowsでやるのと同じようにターミナルからコマンドを実行できますが、そのターミナルはクラウドIDEが準備したどこかのコンピュータに接続されています。 さて、いろいろなクラウドIDE(PaizaCloud Cloud IDE, AWS Cloud9)について見ていきましょう。 クラウドIDEのうちどれかを選んで、指示に従ってください。 +クラウドIDEはコードエディタと、インターネットにつながって動作し、ソフトウェアをインストールしたり、書いたり、実行したりできるコンピュータへのアクセスを提供するツールです。 チュートリアルを通して、クラウドIDEはまるであなたの*ローカルマシン*のように動作するでしょう。 みんながOS XやUbuntuやWindowsでやるのと同じようにターミナルからコマンドを実行できますが、そのターミナルはクラウドIDEが準備したどこかのコンピュータに接続されています。 さて、いろいろなクラウドIDE(PaizaCloud Cloud IDE, AWS Cloud9, Glitch.com)について見ていきましょう。 クラウドIDEのうちどれかを選んで、指示に従ってください。 #### PaizaCloud Cloud IDE @@ -43,31 +43,117 @@ Chromebookを使わない場合は、このセクションを飛ばして、[Pyt この下の部分が、あなたのターミナルです。このターミナルから、遠くにあるCloud 9のコンピュータに指示を送ることができます。ウィンドウのサイズを変更して少し大きくすることもできます。 -### 仮想環境 +#### Glitch.com Cloud IDE -仮想環境 (virtualenvとも呼ばれます) は、取り組んでいるプロジェクト用に、便利なコードを詰め込んでおけるプライベートボックスのようなものです。 様々なプロジェクトの様々なコードがプロジェクト間で混ざってしまわないように、仮想環境を使います。 - -以下を1行ずつ実行してください: - -{% filename %}Cloud 9{% endfilename %} - - mkdir djangogirls - cd djangogirls - python3.6 -mvenv myvenv - source myvenv/bin/activate - pip install django~={{ book.django_version }} +1. Glitch.com<0>に行く - -(最後の行は`~=`とチルダに続けてイコール記号をつけることに注意してください) - -### GitHub - -[GitHub](https://github.com)アカウントを作成してください。 - -### PythonAnywhere - -Django Girls チュートリアルには、デプロイと呼ばれるセクションが含まれています。これはあなたの新しいWebアプリケーションの原動力となるコードを取得して、それを公にアクセス可能なコンピュータ(サーバーと呼ばれます)に移動するプロセスです。これにより、あなたの作ったものを他の人が見られるようになります。 - -Chromebookでチュートリアルを行うとき、(例えばラップトップとは対照的に)インターネットに接続されているコンピュータをすでに使用しているので、この作業は少し変な感じがします。 しかし、Cloud 9のワークスペースを「開発中」の場所、PythonAnywhere をより完成したものを披露する場所として考えると役に立ちます。 - -したがって、[www.pythonanywhere.com](https://www.pythonanywhere.com) へ行って、PythonAnywhereの新規アカウントを作成してください。 \ No newline at end of file + - アカウントをサインアップ(https://glitch.com/signup)するか、GitHubアカウントを持っている場合はそれを使用します。(以下のGitHubの手順を参照してください) + - *新規プロジェクト* をクリックし、 *hello-webpage* を選択します。 + - ツールドロップダウンリスト(ウィンドウの左下にある)をクリックします。 次に、ターミナルのボタンを以下のようなプロンプトとともにターミナルを開くために、ターミナルボタンをクリックします。 + + {% filename %}Terminal{% endfilename %} + + app@name-of-your-glitch-project:~ + + + クラウドIDEとしてGlitch.comを使用する場合、仮想環境を作成する必要はありません。 代わりに、以下のファイルを手動で作成してください。 + + {% filename %}glitch.json{% endfilename %} + + ```json + { + "install": "pip3 install -r requirements.txt --user", + "start": "bash start.sh", + "watch": { + "throttle": 1000 + } + } + ``` + + {% filename %}requirements.txt{% endfilename %} + + Django~={{ book.django_version }} + + + {% filename %}.bash_profile{% endfilename %} + + ```bash + alias python=python3 + alias pip=pip3 + ``` + + {% filename %}start.sh{% endfilename %} + + ```bash + chmod 600 .bash_profile + pip3 install -r requirements.txt --user + python3 manage.py makemigrations + python3 manage.py migrate + python3 manage.py runserver $PORT + ``` + + これらのファイルが作成されたら、ターミナルに行き、次のコマンドを実行して最初のDjangoプロジェクトを作成します。 + + {% filename %}Terminal{% endfilename %} + + django-admin.py startproject mysite . + refresh + + + 詳細なエラーメッセージを表示するには、GlitchアプリケーションのDjangoデバッグログを有効にします。 `mysite/settings.py` ファイルの末尾に以下を追加するだけです。 + + {% filename %}mysite/settings.py{% endfilename %} + + ```python + LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'handlers': { + 'file': { + 'level': 'DEBUG', + 'class': 'logging.FileHandler', + 'filename': 'debug.log', + }, + }, + 'loggers': { + 'django': { + 'handlers': ['file'], + 'level': 'DEBUG', + 'propagate': True, + }, + }, + } + ``` + + これにより、Djangoの操作や出てくる可能性のあるエラーメッセージを詳細に記述した `debug.log` ファイルが作成されるので、ウェブサイトが動作しない場合の修正がとても簡単になります。 + + Glitch プロジェクトの最初の再起動は失敗するはずです。 (一番上のドロップダウンボタン `Show` をクリックし、`In a New Window` をクリックした場合、`DisallowedHost` のエラーメッセージが表示されます)。 この段階では心配しないでください。`mysite/settings.py` ファイルでプロジェクトのDjango設定を更新すれば、チュートリアルですぐに修正されます。 + + ### 仮想環境 + + 仮想環境 (virtualenvとも呼ばれます) は、取り組んでいるプロジェクト用に、便利なコードを詰め込んでおけるプライベートボックスのようなものです。 様々なプロジェクトの様々なコードがプロジェクト間で混ざってしまわないように、仮想環境を使います。 + + Run: + + {% filename %}Cloud 9{% endfilename %} + + mkdir djangogirls + cd djangogirls + python3 -m venv myvenv + source myvenv/bin/activate + pip install django~={{ book.django_version }} + + + (note that on the last line we use a tilde followed by an equal sign: `~=`). + + ### GitHub + + [GitHub](https://github.com) アカウントを作成します。 + + ### PythonAnywhere + + Django Girlsチュートリアルの目次には、デプロイと呼ばれるものに関するチャプターがあります。これはあなたの新しいWebアプリケーションの原動力となるコードを取得して、それを公にアクセス可能なコンピューター(サーバーと呼ばれます)に移動するプロセスです。これにより、あなたのやったことを他の人が見ることができるようになります。 + + Chromebookでチュートリアルを行うとき、この部分は少し奇妙に感じるかもしれません。 すでにインターネットに接続されているコンピュータを使用しているからです。 (例えば、ノートパソコンだとか) しかし、Cloud 9のワークスペースを「開発中」の場所、PythonAnywhere をより完成したものを披露する場所として考えると分かりやすいです。 + + したがって、新しいPythonAnywhereアカウントにサインアップしてください。 [ www.pythonanywhere.com ](https://www.pythonanywhere.com) \ No newline at end of file diff --git a/ja/code_editor/README.md b/ja/code_editor/README.md index 39a5576f1c2..cfae4e1e399 100644 --- a/ja/code_editor/README.md +++ b/ja/code_editor/README.md @@ -6,6 +6,6 @@ > **補足:** Chromebookを使っている方は、このチャプターは飛ばして、 [Chromebookのセットアップ](../chromebook_setup/README.md) の説明に従ってください。 あなたが選んだクラウドIDE(PaizaCloud Cloud IDE もしくは AWS Cloud9)にはコードエディタが含まれています。IDEのファイルメニューからファイルを開くと、自動的にエディタが使用できます。 > -> **注意** インストールの章で、コードエディタのインストールを前もって済ませた人もいるかもしれません。もしそうなら、飛ばして次の章に進んでください! +> **注意** [インストールの章](../installation/README.md)で既にコードエディターのダウウンロードを済ませてしまっているかもしれません。もしそうなら、スキップして次の章に進んでください! {% include "/code_editor/instructions.md" %} \ No newline at end of file diff --git a/ja/code_editor/instructions.md b/ja/code_editor/instructions.md index c4af07bbb1f..de1d5b879d6 100644 --- a/ja/code_editor/instructions.md +++ b/ja/code_editor/instructions.md @@ -34,4 +34,4 @@ Atomも人気のあるエディタで、無料でオープンソース、そし 2つ目の理由は、コードエディタは、コードを編集することに特化しているので、コードを意味によって色づけして強調したり、引用符を自動的に閉じたりするような、便利な機能があります。 -あとで使ってみて、こういった機能が全てわかるようになります。すぐに、信頼できる使い慣れたコードエディタが、お気に入りのツールになると思いますよ^^ +あとで使ってみて、こういった機能が全てわかるようになります。すぐに、信頼できる使い慣れたコードエディタが、お気に入りのツールになると思いますよ^^ \ No newline at end of file diff --git a/ja/css/README.md b/ja/css/README.md index 34dfdf55505..6019d46fac3 100644 --- a/ja/css/README.md +++ b/ja/css/README.md @@ -21,8 +21,7 @@ Bootstrap をインストールするため、`.html` ファイル (blog/templat {% filename %}blog/templates/blog/post_list.html{% endfilename %} ```html - - + ``` これは、あなたのプロジェクトにファイルを追加しているわけではありません。インターネット上にあるファイルを指しているだけです。では、Webサイトを開いてページを再読み込みしてください。 @@ -81,7 +80,7 @@ h1 a, h2 a { `h1 a` はCSSセレクタと呼ばれるものです。 これは、`h1`要素内の`a`要素にスタイルを適用していることを意味します。 `h2 a`セレクタは、`h2`要素に対して同じことを行います。 よって `
published: {{ post.published_date }}
+{{ post.text|linebreaksbr }}
-published: {{ post.published_date }}
+{{ post.text|linebreaksbr }}
-published: {{ post.published_date }}
+{{ post.text|linebreaksbr }}
-published: {{ post.published_date }}
-{{ post.text|linebreaksbr }}
-で始まる名前のファイルを隠しファイルとして扱います。通常のls`コマンドでは、これらのファイルは表示されません。 `.gitignore`fileを見つけるために、代わりに`ls -a`を使います。
>
> **備考:** `.gitignore`ファイルで指定したファイルの1つが`db.sqlite3`です。 そのファイルはローカルデータベースで、すべてのユーザーと投稿が保存されます。 私達は標準的なウェブプログラミングの慣習に従います。つまり、ローカルのテストサイトとPythonAnywhere上の本番のウェブサイトでデータベースを分けるということです。 PythonAnywhereのデータベースは開発用のマシンと同じようにSQLiteにすることができますが、通常はMySQLというSQLiteよりもたくさんのサイト訪問者に対処できるデータベースを使用します。 どちらの方法でも、GitHubのコードのコピーではSQLiteデータベースを無視することで、これまでに作成したすべての投稿と管理者はそのままローカルで利用できますが、本番環境(ブログを公開するPythonAnywhereのことです)ではそれらを再び作成する必要があります。 ローカルデータベースは本当のブログ投稿をブログから削除してしまうことを心配せずに、さまざまなことをテストできるよい遊び場として考えるといいでしょう。
-`git add` コマンドを実行する前や、どのような変更を加えたか定かでない時は、 `git status` コマンドを使用する事をおすすめします。 これは間違ったファイルを追加またはコミットなど思いもかけない事を止めるために役立ちます。 `git status` コマンドは、あらゆる追跡されていない/変更されている/ステージされている(untracked/modifed/staged)ファイルや、ブランチの状態などさまざまな情報を返します。 出力は次のようになります。
+It's a good idea to use a `git status` command before `git add` or whenever you find yourself unsure of what has changed. This will help prevent any surprises from happening, such as wrong files being added or committed. The `git status` command returns information about any untracked/modified/staged files, the branch status, and much more. The output should be similar to the following:
{% filename %}command-line{% endfilename %}
$ git status
- On branch master
+ On branch main
No commits yet
@@ -73,11 +116,11 @@ Git はこのディレクトリ内のすべてのファイルとフォルダの
nothing added to commit but untracked files present (use "git add" to track)
-最後に、変更内容を保存します。コンソールに移動し、これらのコマンドを実行します。
+And finally we save our changes. Go to your console and run these commands:
{% filename %}command-line{% endfilename %}
- $ git add --all .
+ $ git add .
$ git commit -m "My Django Girls app, first commit"
[...]
13 files changed, 200 insertions(+)
@@ -88,135 +131,51 @@ Git はこのディレクトリ内のすべてのファイルとフォルダの
## GitHubにコードをプッシュする
-[GitHub.com](https://www.github.com)にアクセスし、Sign upをクリックして無料の新規アカウントを作成してください。 (ワークショップの前にすでに作成していたら、それは素晴らしいです!) あなたのパスワードを忘れないようにしてください(使っていたら、パスワードマネージャーに入れておいてください)
+Go to [GitHub.com](https://www.github.com) and sign up for a new, free user account. (If you already did that in the workshop prep, that is great!) Be sure to remember your password (add it to your password manager, if you use one).
-そして、新しいリポジトリに "my-first-blog"の名前で新しいリポジトリを作成します。 "READMEで初期化する"チェックボックスをオフのままにし、.gitignoreオプションを空白にして(手動で行っています)、ライセンスをNoneのままにしておきます。
+Then, create a new repository, giving it the name "my-first-blog". Leave the "initialize with a README" checkbox unchecked, leave the .gitignore option blank (we've done that manually) and leave the License as None.

> **注** `my-first-blog`という名前は重要です。何か他のものを選択することもできますが、以下の手順では何度も繰り返す必要があります。他の名前を選択した場合は、 毎回それを置き換えてください。 できれば、`my-first-blog` の名前にしておきましょう。
-次の画面では、リポジトリをクローンするためのURLが表示されます。これはこの後のコマンドで利用します。
+On the next screen, you'll be shown your repo's clone URL, which you will use in some of the commands that follow:

-そして自分のコンピューター上のGitリポジトリをGitHub上のGitリポジトリに結びつけてあげる必要があります。
+Now we need to hook up the Git repository on your computer to the one up on GitHub.
-コンソールに次のように入力します(``をGitHubアカウントの作成時に入力したユーザー名に置き換えます。山カッコ<>を残さないでください。このURLはさっき見たクローンURLと一致する必要があります)。
+Type the following into your console (replace `` with the username you entered when you created your GitHub account, but without the angle-brackets -- the URL should match the clone URL you just saw).
{% filename %}command-line{% endfilename %}
$ git remote add origin https://github.com//my-first-blog.git
- $ git push -u origin master
+ $ git push -u origin main
-GitHubにプッシュするとき、GitHubのユーザー名とパスワードを聞かれます(コマンドライン上かポップアップウィンドウにて)。認証情報を入力したらこんな風に表示されます。
+When you push to GitHub, you'll be asked for your GitHub username and password (either right there in the command-line window or in a pop-up window), and after entering credentials you should see something like this:
{% filename %}command-line{% endfilename %}
Counting objects: 6, done.
Writing objects: 100% (6/6), 200 bytes | 0 bytes/s, done.
Total 3 (delta 0), reused 0 (delta 0)
-
To https://github.com/ola/my-first-blog.git
- * [new branch] master -> master
- Branch master set up to track remote branch master from origin.
-
-
-
-
-あなたのコードは今GitHub上にあります。 見に行きましょう! [ Django ](https://github.com/django/django)や[ Django Girls Tutorial ](https://github.com/DjangoGirls/tutorial)、その他たくさんの素晴らしいオープンソースソフトウェアプロジェクトもGitHubでコードをホストしています。 :)
-
-# PythonAnywhereでブログを設定する
-
-## PythonAnywhere アカウントにサインアップする
-
-> **備考:**あなたがすでにPythonAnywhereのアカウントを以前に作成しインストールの手順をふんでいたら、再びそれを行う必要はありません。
-
-{% include "/deploy/signup_pythonanywhere.md" %}
-
-## PythonAnywhere でサイトを設定する
-
-ロゴをクリックしてメインの[PythonAnywhere Dashboard](https://www.pythonanywhere.com/)に戻り、「Bash」コンソールを起動するボタンをクリックします。これはPythonAnywhereバージョンのコマンドラインで、ちょうどあなたのコンピューターのコマンドラインと同じようなものです。
-
-
-
-> **備考:**PythonAnywhere は Linuxベースなので、Windowsを使っている場合は、コンソールがあなたのものと少し違って見えるでしょう。
-
-PythonAnywhereにWebアプリケーションをデプロイするには、コードをGitHubからプルし、PythonAnywhereがそれを認識してWebアプリケーションのサーバを動かし始めるように設定する必要があります。 それを手動で行う方法もありますが、PythonAnywhereはそれをすべて行うヘルパーツールを提供しています。 まず、インストールしてみましょう。
-
-{% filename %}PythonAnywhere command-line{% endfilename %}
-
- $ pip3.6 install --user pythonanywhere
-
-`Collecting pythonanywhere` のようなメッセージがいくつか出力され、最終的に`Successfully installed (...) pythonanywhere- (...)`という行で終わると思います。
-
-GitHub からアプリを自動的に構成するためのヘルパーを実行します。 PythonAnywhereのコンソールに次のように入力します(GitHubからクローンするときのURLと一致するように、``の代わりにご自身のGitHubユーザー名を使用することを忘れないでください):
-
-{% filename %}PythonAnywhere command-line{% endfilename %}
-
- $ pa_autoconfigure_django.py --python=3.6 https://github.com//my-first-blog.git
+ * [new branch] main -> main
+ Branch main set up to track remote branch main from origin.
-実行しているところを見れば、何をしているのかわかるでしょう。
-
-- GitHubからコードをダウンロードする
-- ちょうどあなたのPC上でやったように、PythonAnywhere上に仮想環境 を作成する
-- 一部のデプロイメント設定で設定ファイルを更新する
-- `manage.py migrate`コマンドを使ってPythonAnywhere上のデータベースをセットアップする
-- 静的ファイルの設定(これについては後で学習します)
-- APIを通じてPythonAnywhereがあなたのWebアプリケーションを提供するように設定する
-
-PythonAnywhereではこれらすべてのステップは自動化されていますが、他のサーバープロバイダーでは同じ手順を自分で実行しなければなりません。
-
-今注目すべき重要な点は、PythonAnywhere上のデータベースが、自分のPC上のデータベースとはまったく別物であることです。つまり、異なる投稿と管理者アカウントを持つことができます。 その結果、自分のコンピュータで行ったように、`createsuperuser`で管理者アカウントを初期化する必要があります。 PythonAnywhereがあなたの代わりに仮想環境を自動的に起動したので、あなたがする必要があるのは以下の通りです:
-
-{% filename %}PythonAnywhere command-line{% endfilename %}
-
- (ola.pythonanywhere.com) $ python manage.py createsuperuser
-
-
-管理者の詳細を入力します。 PythonAnywhere上のパスワードをより安全にしたい場合を除き、混乱を避けるために自分のコンピュータで使用しているのと同じものを使用することをお勧めします。
-
-PythonAnywhereのコードを`ls`を使って見てみることもできます:
-
-{% filename %}PythonAnywhere command-line{% endfilename %}
-
- (ola.pythonanywhere.com) $ ls
- blog db.sqlite3 manage.py mysite requirements.txt static
- (ola.pythonanywhere.com) $ ls blog/
- __init__.py __pycache__ admin.py apps.py migrations models.py
- tests.py views.py
-
-
-また、Filesページに移動し、PythonAnywhereに組み込まれているファイルブラウザを使用して閲覧することもできます。 (ConsoleページからPythonAnywhereの他のページには、右上のメニューボタンからいけます。 一度いずれかのページに移動したら、他ページへのリンクは上部にあります。)
-
-## 動いています!
-
-あなたのサイトは現在、インターネット上で動作しているはずです! PythonAnywhereのWebページをクリックしてリンクを取得します。 あなたはあなたが望む誰とでもこれを共有することができます:)
-
-> **注** これは初心者向けのチュートリアルです。このサイトをデプロイする際にはセキュリティの観点からは理想的ではない、いくつかのショートカットをしました。 もしこのプロジェクトを利用すると決めたり、新しいプロジェクトを開始する場合は、あなたのサイトを安全にするいくつかのヒントについて、[Djangoデプロイチェックリスト](https://docs.djangoproject.com/ja/2.2/howto/deployment/checklist/)を注意深く読んでください。
-
-## デバッギングのヒント
-
-`pa_autoconfigure_django.py`スクリプトの実行中にエラーが表示された場合は、次のような原因が考えられます。
-
-- PythonAnywhere APIトークンの作成を忘れている
-- あなたのGitHubのURLを間違えている
-- *Could not find your settings.py*というエラーが表示された場合は、おそらくGitにすべてのファイルを追加できていなかったか、 GitHubにうまくプッシュできていなかった。 この場合はGitセクションをもう一度見てください
-- PythonAnywhereのアカウントを以前に作成していてcollectstaticでエラーが起きたとしたら、あなたのアカウントで古いバージョンのSQLite(例えば、3.8.2)を使っている可能性があります。 その場合、新しいアカウントを作成して、上記のPythonAnywhereのセクションに記載しているコマンドを実行してください。
-
-サイトにアクセスしようとするとエラーが表示された場合、最初にデバッグ情報を探す場所は**エラーログ**です。 PythonAnywhereの[ Webページ](https://www.pythonanywhere.com/web_app_setup/)には、エラーログへのリンクがあります。 そこにエラーメッセージがあるかどうかを確認してください。 最新のものは一番下にあります。
+
-[ PythonAnywhereヘルプサイトの一般的なデバッグのヒント](http://help.pythonanywhere.com/pages/DebuggingImportError)もあります。
+Your code is now on GitHub. Go and check it out! You'll find it's in fine company – [Django](https://github.com/django/django), the [Django Girls Tutorial](https://github.com/DjangoGirls/tutorial), and many other great open source software projects also host their code on GitHub. :)
-つまづいた時は、コーチに助けを求めましょう。
+{% include "/deploy/pythonanywhere.md" %}
-# あなたのサイトをチェック!
+# Check out your site!
-サイトのデフォルトページでは、ローカルコンピュータと同じように「It worked!」と表示されます。 URLの最後に`/admin/`を追加すると、管理サイトに移動します。 ユーザー名とパスワードでログインしたら、Postsへのリンクからサーバーに新規投稿を追加できることがわかるでしょう。ローカルのテスト用データベースの投稿は本番環境のブログに送られていないことも忘れないてくださいね。
+The default page for your site should say "It worked!", just like it does on your local computer. Try adding `/admin/` to the end of the URL, and you'll be taken to the admin site. Log in with the username and password, and you'll see you can add new Posts on the server -- remember, the posts from your local test database were not sent to your live blog.
-いくつかの投稿を作成したら、ローカル環境(PythonAnywhereではなく)に戻ることができます。 ここから、変更を加えるためにはあなたのローカル環境で作業する必要があります。 これがWeb開発の一般的なワークフローです。ローカルで変更し、それらの変更をGitHubにプッシュし、それからその変更を公開しているWebサーバーにプルしてきます。 これにより、公開しているWebサイトを壊すことなく作業したり試したりできます。 とってもクールでしょ?
+Once you have a few posts created, you can go back to your local setup (not PythonAnywhere). From here you should work on your local setup to make changes. This is a common workflow in web development – make changes locally, push those changes to GitHub, and pull your changes down to your live Web server. This allows you to work and experiment without breaking your live Web site. Pretty cool, huh?
-自分を*すっごく*褒めてあげてください! サーバーのデプロイはWeb開発の最も難しい部分の1つで、ちゃんと動くようになるまで数日かかることもよくあります。 しかし、あなたは実際のインターネット上で、あなたのサイトを動かす事ができました!
\ No newline at end of file
+Give yourself a *HUGE* pat on the back! Server deployments are one of the trickiest parts of web development and it often takes people several days before they get them working. But you've got your site live, on the real Internet!
\ No newline at end of file
diff --git a/ja/deploy/install_git.md b/ja/deploy/install_git.md
index f994671fc46..efe2bee0b39 100644
--- a/ja/deploy/install_git.md
+++ b/ja/deploy/install_git.md
@@ -7,6 +7,8 @@ data-collapse=true ces-->
[git-scm.com](https://git-scm.com/) からGitをダウンロードすることができます。 2つのステップを除いて「次へ」を押して進んで大丈夫です。エディタを選ぶステップでは、Nanoを選んでください。「PATH環境を調整する(Adjusting your PATH environment)」というステップでは、「Use Git and optional Unix tools from the Windows Command Prompt(WindowsコマンドプロンプトからGitとオプションのUnixツールを使用する)」(一番下の選択肢)を選択します。 それ以外はデフォルトの設定値で構いません。 改行コードの変換(Configuring the line ending conversions)については、「Checkout Windows-style, commit Unix-style line endings」の選択で大丈夫です。
+インストール中、「Adjusting the name of the initial branch in new repositories(新しいリポジトリの最初のブランチ名を調整する)」オプションが表示されている場合、「Override the default(デフォルトを上書きする)」 を選択し「main」を使用してください。 これにより、あなたがインストールしたGitが世界中の開発者コミュニティの幅広い方向性に沿ったものになります。このチュートリアルの残りの部分では、「main」ブランチを使用します。 この詳細については、https://sfconservancy.org/news/2020/jun/23/gitbranchname/ および https://github.com/github/renamingを参照してください。
+
インストールが正常に終了した後、コマンドプロンプトまたはPowerShellを再起動することを忘れないでください。
[git-scm.com](https://git-scm.com/) からGitをダウンロードし、指示に従ってください。
+インストール中、「Adjusting the name of the initial branch in new repositories(新しいリポジトリの最初のブランチ名を調整する)」オプションが表示されている場合、「Override the default(デフォルトを上書きする)」 を選択し「main」を使用してください。 これにより、あなたがインストールしたGitが世界中の開発者コミュニティの幅広い方向性に沿ったものになります。このチュートリアルの残りの部分では、「main」ブランチを使用します。 この詳細については、https://sfconservancy.org/news/2020/jun/23/gitbranchname/ および https://github.com/github/renamingを参照してください。
+
> **注** OS X 10.6,10.7、または10.8を実行している場合は、ここからgitのバージョンをインストールする必要があります: [Git installer for OS X Snow Leopard](https://sourceforge.net/projects/git-osx-installer/files/git-2.3.5-intel-universal-snow-leopard.dmg/download)
@@ -27,6 +31,15 @@ data-collapse=true ces-->
$ sudo apt install git
```
+### デフォルトブランチ名を設定する
+
+これにより、あなたがインストールしたGitが世界中の開発者コミュニティの幅広い方向性に沿ったものになります。このチュートリアルの残りの部分では、「main」ブランチを使用します。 この詳細については、https://sfconservancy.org/news/2020/jun/23/gitbranchname/ および https://github.com/github/renamingを参照してください。
+
+{% filename %}command-line{% endfilename %}
+
+ $ git config --global --add init.defaultBranch main
+
+
$ sudo dnf install git
```
+### デフォルトブランチ名を設定する
+
+これにより、あなたがインストールしたGitが世界中の開発者コミュニティの幅広い方向性に沿ったものになります。このチュートリアルの残りの部分では、「main」ブランチを使用します。 この詳細については、https://sfconservancy.org/news/2020/jun/23/gitbranchname/ および https://github.com/github/renamingを参照してください。
+
+{% filename %}command-line{% endfilename %}
+
+ $ git config --global --add init.defaultBranch main
+
+
$ sudo zypper install git
```
+### デフォルトブランチ名を設定する
+
+これにより、あなたがインストールしたGitが世界中の開発者コミュニティの幅広い方向性に沿ったものになります。このチュートリアルの残りの部分では、「main」ブランチを使用します。 この詳細については、https://sfconservancy.org/news/2020/jun/23/gitbranchname/ および https://github.com/github/renamingを参照してください。
+
+{% filename %}command-line{% endfilename %}
+
+ $ git config --global --add init.defaultBranch main
+
+
\ No newline at end of file
diff --git a/ja/deploy/pythonanywhere.md b/ja/deploy/pythonanywhere.md
new file mode 100644
index 00000000000..d3d63ae6ae4
--- /dev/null
+++ b/ja/deploy/pythonanywhere.md
@@ -0,0 +1,88 @@
+# Setting up our blog on PythonAnywhere
+
+## Sign up for a PythonAnywhere account
+
+> **Note** You might have already created a PythonAnywhere account earlier during the install steps – if so, no need to do it again.
+>
+> {% include "/deploy/signup_pythonanywhere.md" %}
+
+
+## Configuring our site on PythonAnywhere
+
+Go back to the main [PythonAnywhere Dashboard](https://www.pythonanywhere.com/) by clicking on the logo, and choose the option to start a "Bash" console – that's the PythonAnywhere version of a command line, just like the one on your computer.
+
+
+
+> **Note** PythonAnywhere is based on Linux, so if you're on Windows, the console will look a little different from the one on your computer. Deploying a web app on PythonAnywhere involves pulling down your code from GitHub, and then configuring PythonAnywhere to recognise it and start serving it as a web application. There are manual ways of doing it, but PythonAnywhere provides a helper tool that will do it all for you. Let's install it first:
+
+{% filename %}PythonAnywhere command-line{% endfilename %}
+```
+$ pip{{ book.pa_py_version }} install --user pythonanywhere
+```
+
+That should print out some things like `Collecting pythonanywhere`, and eventually end with a line saying `Successfully installed (...) pythonanywhere- (...)`.
+
+Now we run the helper to automatically configure our app from GitHub. Type the following into the console on PythonAnywhere (don't forget to use your GitHub username in place of ``, so that the URL matches the clone URL from GitHub):
+
+{% filename %}PythonAnywhere command-line{% endfilename %}
+```
+$ pa_autoconfigure_django.py --python={{ book.pa_py_version }} https://github.com//my-first-blog.git
+```
+
+As you watch that running, you'll be able to see what it's doing:
+
+- Downloading your code from GitHub
+- Creating a virtualenv on PythonAnywhere, just like the one on your own computer
+- Updating your settings file with some deployment settings
+- Setting up a database on PythonAnywhere using the `manage.py migrate` command
+- Setting up your static files (we'll learn about these later)
+- And configuring PythonAnywhere to serve your web app via its API
+
+On PythonAnywhere all those steps are automated, but they're the same steps you would have to go through with any other server provider.
+
+The main thing to notice right now is that your database on PythonAnywhere is actually totally separate from your database on your own computer, so it can have different posts and admin accounts. As a result, just as we did on your own computer, we need to initialize the admin account with `createsuperuser`. PythonAnywhere has automatically activated your virtualenv for you, so all you need to do is run:
+
+{% filename %}PythonAnywhere command-line{% endfilename %}
+```
+(ola.pythonanywhere.com) $ python manage.py createsuperuser
+```
+
+Type in the details for your admin user. Best to use the same ones as you're using on your own computer to avoid any confusion, unless you want to make the password on PythonAnywhere more secure.
+
+Now, if you like, you can also take a look at your code on PythonAnywhere using `ls`:
+
+{% filename %}PythonAnywhere command-line{% endfilename %}
+```
+(ola.pythonanywhere.com) $ ls
+blog db.sqlite3 manage.py mysite requirements.txt static
+(ola.pythonanywhere.com) $ ls blog/
+__init__.py __pycache__ admin.py apps.py migrations models.py
+tests.py views.py
+```
+
+You can also go to the "Files" page and navigate around using PythonAnywhere's built-in file browser. (From the Console page, you can get to other PythonAnywhere pages from the menu button in the upper right corner. Once you're on one of the pages, there are links to the other ones near the top.)
+
+
+## You are now live!
+
+Your site should now be live on the public Internet! Click through to the PythonAnywhere "Web" page to get a link to it. You can share this with anyone you want. :)
+
+
+> **Note** This is a beginners' tutorial, and in deploying this site we've taken a few shortcuts which aren't ideal from a security point of view. If and when you decide to build on this project, or start a new project, you should review the [Django deployment checklist](https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/) for some tips on securing your site.
+
+## Debugging tips
+
+
+If you see an error while running the `pa_autoconfigure_django.py` script, here are a few common causes:
+
+- Forgetting to create your PythonAnywhere API token.
+- Making a mistake in your GitHub URL
+- If you see an error saying *"Could not find your settings.py"*, it's probably because you didn't manage to add all your files to Git, and/or you didn't push them up to GitHub successfully. Have another look at the Git section above
+- If you previously signed up for a PythonAnywhere account and had an error with collectstatic, you probably have an older version of SQLite (eg 3.8.2) for your account. In that case, sign up for a new account and try the commands in the PythonAnywhere section above.
+
+
+If you see an error when you try to visit your site, the first place to look for some debugging info is in your **error log**. You'll find a link to this on the PythonAnywhere ["Web" page](https://www.pythonanywhere.com/web_app_setup/). See if there are any error messages in there; the most recent ones are at the bottom.
+
+There are also some [general debugging tips on the PythonAnywhere help site](http://help.pythonanywhere.com/pages/DebuggingImportError).
+
+And remember, your coach is here to help!
diff --git a/ja/django_admin/README.md b/ja/django_admin/README.md
index 9feaee9d5eb..882c20e3f6f 100644
--- a/ja/django_admin/README.md
+++ b/ja/django_admin/README.md
@@ -1,6 +1,6 @@
# Django admin
-今作成したポストを追加、編集、削除するのにDjango adminを使います。
+ブログの投稿を追加、編集、削除するのにDjango adminを使います。
`blog/admin.py`ファイルをエディタで開いて、内容をこのように変えて下さい:
@@ -52,6 +52,6 @@ Postsをクリックして移動し、少し試してみましょう。 5つか6

-Django adminについてもっと知りたいときは、Djangoのドキュメントを見るとよいでしょう。https://docs.djangoproject.com/ja/2.2/ref/contrib/admin/
+If you want to know more about Django admin, you should check Django's documentation: https://docs.djangoproject.com/en/3.2/ref/contrib/admin/
ここでそろそろコーヒー(または紅茶)か何か食べるものを摂って自分を元気づけるのにいいタイミングでしょう。最初のDjangoモデルを作ったのだから、少し休みをとっていいところです!
\ No newline at end of file
diff --git a/ja/django_forms/README.md b/ja/django_forms/README.md
index 9137fd1026a..fad20285ea3 100644
--- a/ja/django_forms/README.md
+++ b/ja/django_forms/README.md
@@ -1,6 +1,6 @@
# Djangoフォーム
-私たちのWebサイトで最終的にやりたいことは、記事を追加したり編集したりするためのよい方法を作ることです。 `Django admin`はかなりいいですが、カスタマイズしたりかわいくいい感じにするのはちょっと大変です。 `フォーム` によってインターフェイスを完璧にコントロールできるようになります。想像するほとんど全てのことができます!
+私たちのWebサイトで最終的にやりたいことは、投稿を追加したり編集したりするためのよい方法を作ることです。 `Django admin`はかなりいいですが、カスタマイズしたりかわいくいい感じにするのはちょっと大変です。 `フォーム` によってインターフェイスを完璧にコントロールできるようになります。想像するほとんど全てのことができます!
Djangoフォームのよいところは、フォームをゼロから定義できたり、フォームの結果をモデルに保存できる`ModelForm`を作れたりするところです。
@@ -36,7 +36,7 @@ class PostForm(forms.ModelForm):
次に`class Meta`ですが、ここでDjangoにフォームを作るときにどのモデルを使えばいいか (`model = Post`) を伝えます。
-最後にフォームのフィールドに何を置くか書きます。 ここでは、私たちは`title`(タイトル)と `text`(本文)のみをフォームで使用します。 `author` は現在ログインしている人(あなた)です。 `created_date` は(コードによって)自動的に記事を書いた日時が設定されます。
+最後にフォームのフィールドに何を置くか書きます。 今回は、私たちは`title`(タイトル)と `text`(本文)のみをフォームで使用します。 `author` は現在ログインしている人(あなた)です。 `created_date` は(コードによって)自動的に投稿を作った日時が設定されます。
ひとまずこれでおしまいです!あとはフォームを*ビュー*で使い、それをテンプレート内に表示しさえすればいいです。
@@ -44,15 +44,23 @@ class PostForm(forms.ModelForm):
## フォームにおけるページへのリンク
-`blog/templates/blog/base.html` をエディタで開きましょう。`page-header` と名付けた `div` 中に次のリンクを追加します:
+リンクを追加する前に、いくつかのアイコンをリンクのボタンとして使用する必要があります。 このチュートリアルでは、 [file-earmark-plus.svg](https://raw.githubusercontent.com/twbs/icons/main/icons/file-earmark-plus.svg) をダウンロードし、 `blog/templates/blog/icons/` に保存してください。
+
+> 注意: SVG 画像をダウンロードするには、リンク上のコンテキストメニュー(通常は右クリックして)を開き、「名前を付けてリンクを保存」を選択します。 ファイルを保存する場所を尋ねるダイアログでは、Djangoプロジェクトの `djangogirls` ディレクトリに移動し、その中のサブディレクトリ `blog/templates/blog/icons/` に移動して、そこにファイルを保存します。
+
+`blog/templates/blog/base.html` をエディタで開きましょう。 これで基本テンプレート内のアイコンファイルを以下のように使用できます。 `header` セクション内の `div` 要素では、`h1` 要素の前にリンクを追加します。
{% filename %}blog/templates/blog/base.html{% endfilename %}
```html
-
+
+ {% include './icons/file-earmark-plus.svg' %}
+
```
-新しいビュー` post_new `を呼び出すことに注意してください。 ` "glyphicon glyphicon-plus" `クラスは、使用しているBootstrapテーマによって提供され、プラス記号を表示します。
+`post_new`という新しいビューを作ります。 SVGアイコン [](https://icons.getbootstrap.com/icons/file-earmark-plus/) は [ブートストラップアイコン](https://icons.getbootstrap.com/) によって提供され、プラス記号のページアイコンが表示されます。 Djangoテンプレートディレクティブの `include` を使います。 これにより、Djangoテンプレートにファイルの内容が挿入されます。 ウェブブラウザは、この種のコンテンツを処理する方法を知っているので、これ以上の処理は必要ありません。
+
+> ブートストラップアイコンは [こちら](https://github.com/twbs/icons/releases/download/v1.1.0/bootstrap-icons-1.1.0.zip)からダウンロードできます。 ファイルを解凍し、すべてのSVG画像ファイルを `blog/templates/blog/` の中の `icon` という新しいフォルダにコピーします。 これにより、`blog/templates/blog/icons/pencil-fill.svg` というファイルパスで `pencil-fill.svg` のようなアイコンにアクセスすることができます。
行を追加すると、このような html ファイルになります。
@@ -60,27 +68,31 @@ class PostForm(forms.ModelForm):
```html
{% load static %}
+
Django Girls blog
-
-
+
-
-
- Django Girls Blog
-
-
+
+
+
+
-
+
{% block content %}
{% endblock %}
-
+
```
@@ -97,7 +109,7 @@ class PostForm(forms.ModelForm):
path('post/new/', views.post_new, name='post_new'),
```
-すると最終的なコードは次のようになります:
+次に、このような内容を追加します。
{% filename %}blog/urls.py{% endfilename %}
@@ -134,20 +146,20 @@ def post_new(request):
return render(request, 'blog/post_edit.html', {'form': form})
```
-`Post`フォームを新しく作るには、`PostForm()`を呼び出し、それをテンプレートに渡す必要があります。 あとでこの *ビュー* に戻ってきますが、今はフォームのためのテンプレートをすぐに作ってしまいましょう。
+新しい `Post` フォームを作成するには、 `PostForm()` を呼び出してテンプレートに渡す必要があります。 あとでこの *ビュー* に戻ってきますが、今はフォームのためのテンプレートをすぐに作ってしまいましょう。
## テンプレート
-`blog/templates/blog`ディレクトリに`post_edit.html`ファイルを作り、エディタで開きましょう。フォームを動かすにはいくつかやることがあります。
+`blog/templates/blog` ディレクトリに `post_edit.html` ファイルを作成し、それをコード エディターで開きます。 フォームを動かすにはいくつかやることがあります。
* フォームを表示する必要があります。 私たちは(例えば){% raw %}`{{ form.as_p }}`{% endraw %} でこれを行うことができます。
* 上記の行は HTMLのformタグでラップする必要があります:``
* `Save` ボタンが必要です。これをHTMLのbuttonタグで行います:``
* 最後に`
{% endblock %}
```
更新をしてみましょう。やった!フォームが表示されます。
-
+
ちょっと待ってみて下さい。`title` と `text` フィールドに何か入力して保存するとどうなりますか?
@@ -185,9 +197,9 @@ def post_new(request):
return render(request, 'blog/post_edit.html', {'form': form})
```
-フォームを送信したとき、同じビューに戻されていましたが、このとき`request`、もっと詳しくいうと `request.POST` にデータが追加されています (このPOSTという名前はブログ投稿 "post" とは関係ありません。このデータは送られてきたもの、というコトと関係しています) 。 HTMLファイルの `