diff --git a/README.md b/README.md index 6c0e449..c5f7a17 100644 --- a/README.md +++ b/README.md @@ -25,20 +25,6 @@ To use `django-layout`: 3. install Django with `pip install django` -4. run the following command (replace `YOUR_PROJECT_NAME` with your preferred name): - - django-admin.py startproject --template=https://github.com/lincolnloop/django-layout/zipball/main --extension=py,md,gitignore,cfg,in,yml,json,dockerignore --name=Makefile,Dockerfile YOUR_PROJECT_NAME - -## Postgres - -If you want to use Postgres database, you can - -- go to the generated project folder, -- uncomment the lines preceded by `# Postgres` in - - `requirements/requirements.in` - - `docker-compose.yml` - - `{{ project_name }}/config.py` -- replace `{{ project_name }}` with the project name you chose. *Note: The text following this comment block will become the README.md of the new project.* diff --git a/docker-compose.yml b/docker-compose.yml index 33a115a..37cc7bb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -13,28 +13,30 @@ services: - /home/node/app/node_modules - client:/home/node/app/client/dist - # Postgres - # db: - # image: postgres:13.2-alpine - # volumes: - # - pgdata:/var/lib/postgresql/data/ - # - .data/db_dumps:/db_dumps - # environment: - # - POSTGRES_DB={{ project_name }} - # - POSTGRES_PASSWORD=postgres + db: + image: postgres:16-alpine + volumes: + - pgdata:/var/lib/postgresql/data/ + - .data/db_dumps:/db_dumps + healthcheck: + test: /usr/bin/pg_isready + interval: 5s + timeout: 10s + retries: 120 + environment: + - POSTGRES_DB={{ project_name }} + - POSTGRES_PASSWORD=postgres app: <<: &COMMON build: context: . target: build-python - # Postgres - # depends_on: - # - db + postgres: + condition: service_healthy environment: - DEBUG=true - # Postgres - # - DATABASE_URL=postgres://postgres:postgres@db:5432/{{ project_name }} + - DATABASE_URL=postgres://postgres:postgres@db:5432/{{ project_name }} stdin_open: true tty: true restart: on-failure @@ -56,5 +58,4 @@ services: volumes: client: - # Postgres - # pgdata: + pgdata: diff --git a/requirements/requirements.in b/requirements/requirements.in index 9e6d953..b2fc625 100644 --- a/requirements/requirements.in +++ b/requirements/requirements.in @@ -8,5 +8,4 @@ goodconf[yaml] django-alive django-csp whitenoise -# Postgres -# psycopg2 +psycopg2