Disable makemigrations in fly launch

Hi all. I use Docker to develop Django locally, I do not work with venv, I don’t see much of a point in using venv and Docker… previous to this I had a pretty streamlined vagrant dev deployment process so I haven’t used venv for years.

Is there a way I could disable the python manage.py makemigrations step in the fly launch process? I don’t want to make or run migrations, just launch the app and import my own postgres dump after the fact.

I guess the “solution” would be to create a venv for every app I want to launch, install requirements, then delete the venv once the launch process is complete and makemigrations could run successfully.

I ended up caving and using venv to install requirements, which then allowed the fly launch process to complete… still not sure why we would “need” to run makemigrations. Eventually filed the whole thing into the too hard basket, more work than required when I can spin up a VM and configure an NGINX + Gunicorn + Postgres production env in 15 minutes.

Then I spent an hour or two scratching my head, trying to come up with the best approach to local Docker development, and production Docker instance via fly.io, importing a database etc etc etc. I have to be missing something obvious, like this seems way harder than it should be.

I will come back in a couple of years and see how things are going with regards to Django documentation. Hopefully the launch/deploy process is improved to include passing some arguments like choosing to skip makemigrations (maybe this already exists, I’m just dipping my toes for the first time) and importing fixtures or a db dump instead.

Hopefully you guys have more luck than me with deploying existing/mature Django apps!

You should be able to crack open the Dockerfile we generate and comment lines out. We generate one explicitly so you can edit it later.

The fly.toml we generate also includes a [deploy] section with a release_command. You can delete and comment that, as well, if migrations aren’t a thing that should run on Deploy.

I don’t use Docker for local dev, just for packaging deploys. Docker kind of sucks locally. But it’s an ok packaging format.

I’m a little confused… I am aware running fly launch is what generates the Dockerfile, which will not complete unless it runs python manage.py makemigrations - so this is before I can even get to fly deploy.

What needs to be commented out here to stop the makemigrations from happening during launch, I spent a lot of time here and can’t see anything relating to makemigrations?

If fly launch doesn’t complete, then I don’t get a fly.toml file so I can’t run fly deploy… I did comment out the migrate line in the fly.toml file that was generated to see if I could load a Django fixture there instead but it was just easier to proxy psql after the fact.

1 Like