WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Running migrate without starting the web server #73

@awgymer

Description

@awgymer

I am wondering if it would be possible to add a command and/or documentation around the best way (if it makes sense) to run migrate (or other manage.py commands) without actually starting the web server.

The rationale behind this is that there are some cases where you want to populate the database or run some other management command without having the actual web server running (such as things you want to ensure happen before any celery tasks are sent).

The best I could come up with so far was to do something like:

## Bring up just Redis and Postgres
COMPOSE_PROFILES=cache,db docker compose up 

## In another shell
docker compose run --no-deps --rm python3 manage.py migrate

Do you have any thoughts on whether this is an OK thing to do? Is there a better way to run some pre-start commands (which may take arbitrarily long).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions