0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Djangoプロジェクト構築時のお作法

0
Last updated at Posted at 2026-03-22

Django作業メモ

DjangoでWebアプリを構築する際に実施するお作法のメモ

01.フォルダ構成

dir01
├─.venv
├─.gitignore
├─README.md
├─requirements.txt
└─プロジェクトルート/
  ├config/
  ├manage.py
  ├アプリ01
  ├アプリ02

02.Python仮想環境用意

pythonは事前にインストールしているものとします。
以下のコマンドでpythonのバージョンを確認しておきます。

bach
python -V

Python仮想環境作成

以下のコマンドで任意のディレクトリにpython仮想環境を構築します。

bach
python -m venv .venv-name
source .venv-name/Scripts/activate

deactivateとコマンドを入力することでpython仮想環境を停止できます。

ライブラリインストール

pipを最新バージョンにし、python仮想環境に必要な外部ライブラリをインストールします。

bach
python -m pip install --upgrade pip
python -m pip install Django
python -m django --version # djangoのバージョン確認

pip freeze > requirements.txt # 外部ライブラリの一覧を出力する

pip listまたはpip freezeでpython仮想環境にインストールした外部ライブラリ一覧を確認することができます。

03.Djangoプロジェクト

プロジェクトルートとなるディレクトリを作成し、作成したディレクトリへ移動した後に、Djangoプロジェクトを構築する。

bach
mkdir mysite
cd mysite/
django-admin startproject config .

python manage.py startapp アプリ名
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?