LoginSignup
0
0

More than 1 year has passed since last update.

[Docker][Django]DockerでDjangoを立ち上げる時に必要なおまじない

Last updated at Posted at 2023-02-23

Docker compose upする前に

  1. Djangoプロジェクトを作成する

    Shell
    docker compose run --rm web django-admin startproject myproject .
    
  2. Setting.pyの修正(データベースの修正)

    myprject\setting.py
    DATABASES = {
        'default': {
            #'ENGINE': 'django.db.backends.sqlite3',
            #'NAME': BASE_DIR / 'db.sqlite3',
            'ENGINE': 'django.db.backends.postgresql',
            'NAME': 'testdb',
            'USER': 'testuser',
            'PASSWORD': 'testpass',
            'HOST': 'db',
            'PORT': '5432',
        }
    }
    

localhost:8000にDjangoが立ち上がる

Docker&仮想サーバー完全入門を参考にさせていただきました。 良書です。

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