3
3

More than 3 years have passed since last update.

Django Webアプリ作成

Last updated at Posted at 2020-09-02

プロジェクトを作成し、開発用サーバーを立ち上げるまで

Django勉強の備忘録
前提:python,Djangoインストール済み

Djangoがインストールされているか確認する

Djangoのバージョンがわかります
存在しなければ"No module named django"と表示されます

$ python -m django --version
3.1.1

プロジェクトを作成する

$ django-admin startproject myproject

myprojectディレクトリ配下に以下のディレクトリとファイルが作成される

myproject/
    manage.py
    mysite/
        __init__.py
        settings.py
        urls.py
        asgi.py
        wsgi.py

開発用サーバーを起動する

$ python manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 18 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
September 02, 2020 - 22:38:08
Django version 3.1.1, using settings 'myproject.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

サーバーが起動されていることを確認します
http://127.0.0.1:8000/
ブラウザでアクセスします
下のようなページが表示されれば成功です
キャプチャ.PNG

3
3
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
3
3