Skip to content

Commit

Permalink
Auto-run migrations on 'docker compose up'.
Browse files Browse the repository at this point in the history
  • Loading branch information
toolness committed Jun 14, 2021
1 parent fb0e441 commit 3570550
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ services:
entrypoint: ["./test_project/wait-for-postgres.sh"]
ports:
- "${APP_PORT:-8000}:${APP_PORT:-8000}"
command: python test_project/manage.py runserver 0.0.0.0:${APP_PORT:-8000}
command: bash -c "python test_project/manage.py migrate && python test_project/manage.py runserver 0.0.0.0:${APP_PORT:-8000}"
docs:
build: .
volumes:
Expand Down
17 changes: 6 additions & 11 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,20 +79,19 @@ At this point, you'll be in a bash shell inside your container, and can run deve

The Docker Compose setup is configured to run a simple test project that you can use to tinker with the dashboard interactively.

To set this up, first run:
To use it, run:

```
docker-compose run app python test_project/manage.py migrate
docker-compose run app python test_project/manage.py createsuperuser
docker-compose up
```

You will now be prompted to enter details about a new superuser. Once you've done that, run:
Then, in a separate terminal, run:

```
docker-compose up
docker-compose run app python test_project/manage.py createsuperuser
```

You can now visit the example app's dashboard at http://localhost:8000/.
You will now be prompted to enter details about a new superuser. Once you've done that, you can visit the example app's dashboard at http://localhost:8000/. After entering the credentials for the superuser you just created, you will be able to tinker with the dashboard.

### Editing the documentation

Expand Down Expand Up @@ -129,11 +128,7 @@ The project's Python dependencies are all baked into the container image, which
docker-compose build
```

You may also want to apply any new migrations that were added to the codebase:

```
docker-compose run app python test_project/manage.py migrate
```
You will also want to restart `docker-compose up`.

### Cleaning up

Expand Down

0 comments on commit 3570550

Please sign in to comment.