【Django】管理ツールを使ってデータベースに接続する
Djangoではデータベースの管理ツールが用意されていて、それを使ってWEB上でテーブルなどの編集が行えます。管理者の作成まずはコマンドプロンプトにて管理者を作成します。C:\django_app>python manage.py createsupe
Djangoではデータベースの管理ツールが用意されていて、それを使ってWEB上でテーブルなどの編集が行えます。管理者の作成まずはコマンドプロンプトにて管理者を作成します。C:\django_app>python manage.py createsupe
セッションの働きセッションを利用することでアクセスしたクライアントの情報をずっと維持することができます。このセッションは、Djangoプロジェクトに最初から組み込まれています。settings.pyのINSTALLED_APPSとMIDDLEWAREという値になります。django
複数項目選択ができるリストを作成します。hello/views.pyfrom django.shortcuts import renderfrom django.http import HttpResponsefrom django.views.generic
複数の項目から1つを選ぶラジオボタンを作成します。hello/views.pyfrom django.shortcuts import renderfrom django.http import HttpResponsefrom django.views.gen
任意の値を設定してプルダウンメニューを作成する方法です。hello/views.pyfrom django.shortcuts import renderfrom django.http import HttpResponsefrom django.views.
「unknown」「YES」「NO」から選択するフィードです。hello/views.pyfrom django.shortcuts import renderfrom django.http import HttpResponsefrom django.vie
まず、index.htmlにフォームを用意します。hello/templates/index.html<body class="container"> <h1 class="display-4 text-p
外部からロードして使うファイルは「静的ファイル」と呼ばれます。例えば、cssファイルやjavascriptファイルなど様々です。静的ファイルは「static」フォルダを使い設定します。「hello」→「static」→「hello」→「css」hello/static/he
テンプレートによる表示は複数のページを用意して、行き来することもできます。hello/templates/hello/index.html<!doctype html><html lang="ja"><h
views.pyのindexからテンプレートのindex.htmlに値を渡す方法です。hello/views.py → hello/templates/hello/index.htmlhello/templates/hello/index.html