# Django Migrate Command

**URL:** <https://community.fly.io/t/django-migrate-command/6583>\
**Category:** Django\
**Created:** [August 26, 2022, 4:11pm UTC](https://community.fly.io/t/django-migrate-command/6583 "2022-08-26T16:11:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![damrofti](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@damrofti](https://community.fly.io/u/damrofti)\
**Post date:** [August 26, 2022, 4:11pm UTC](https://community.fly.io/t/django-migrate-command/6583/1 "2022-08-26T16:11:31Z")

</div>

Hey folks,

I’m giving Fly a spin to see how it handles Django apps. The setup and deploy went well and the process was nice and straight-forward.

I then went to run the the `manage.py migrate` command. First off when I ssh into the app `python` is not available on the PATH.

To get it to work I had to do the following:

```auto
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/layers/paketo-buildpacks_cpython/cpython/lib
export PYTHONPATH=$PYTHONPATH:/layers/paketo-buildpacks_pip-install/packages/lib/python3.10/site-packages
export PATH=$PATH:/layers/paketo-buildpacks_cpython/cpython/bin

```

The migration started but then was killed:

```auto
# python manage.py migrate
Operations to perform:
  Apply all migrations: admin, api, auth, contenttypes, django_rest_passwordreset, oauth2_provider, sessions, social_django, taggit
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying taggit.0001_initial... OK
  Applying taggit.0002_auto_20150616_2121... OK
  Applying contenttypes.0002_remove_content_type_name... OK
  Applying taggit.0003_taggeditem_add_unique_index... OK
  Applying auth.0001_initial... OK
  Applying auth.0002_alter_permission_name_max_length... OK
  Applying auth.0003_alter_user_email_max_length... OK
  Applying auth.0004_alter_user_username_opts... OK
  Applying auth.0005_alter_user_last_login_null... OK
  Applying auth.0006_require_contenttypes_0002... OK
  Applying auth.0007_alter_validators_add_error_messages... OK
  Applying auth.0008_alter_user_username_max_length... OK
  Applying auth.0009_alter_user_last_name_max_length... OK
  Applying auth.0010_alter_group_name_max_length... OK
  Applying auth.0011_update_proxy_permissions... OK
  Applying auth.0012_alter_user_first_name_max_length... OK
  Applying api.0001_initial...Killed

```

This happened numerous times until eventually all the migrations were applied. Why does the migration get killed? Is there anyway for me to find more info on why this might be happening?

---

<div class="post-metadata">

**Author:** ![jphenow](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/jphenow/32/51156_2.png) [@jphenow](https://community.fly.io/u/jphenow)\
**Post date:** [August 26, 2022, 4:44pm UTC](https://community.fly.io/t/django-migrate-command/6583/2 "2022-08-26T16:44:12Z")

</div>

My first guess might be out-of-memory given the default size of our VMs.

You can investigate a little further by running `fly status --all` to see your VMs listed, then you can inspect a particular VM by running `fly vm status <id>` where the ID comes from that first status command - it should also be the hostname of the VM when you’re SSH’d into it.

If you wind up wanting to investigate adding more memory, we have some documentation here for that: [Scaling and Autoscaling · Fly Docs](https://fly.io/docs/reference/scaling/)

---

<div class="post-metadata">

**Author:** ![rugwiro](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rugwiro/32/49239_2.png) [@rugwiro](https://community.fly.io/u/rugwiro)\
**Post date:** [August 26, 2022, 4:46pm UTC](https://community.fly.io/t/django-migrate-command/6583/3 "2022-08-26T16:46:59Z")

</div>

Also, have you tried the release command: [App Configuration (fly.toml) · Fly Docs](https://fly.io/docs/reference/configuration/#run-one-off-commands-before-releasing-a-deployment)? You might be better off running your migrations during the deployment process.

---

<div class="post-metadata">

**Author:** ![damrofti](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@damrofti](https://community.fly.io/u/damrofti)\
**Post date:** [August 29, 2022, 6:13am UTC](https://community.fly.io/t/django-migrate-command/6583/4 "2022-08-29T06:13:09Z")

</div>

Thanks. I haven’t been able to reproduce since, which is a pity, so I haven’t been able to investigate further.

---

<div class="post-metadata">

**Author:** ![damrofti](https://avatars.discourse-cdn.com/v4/letter/d/45deac/32.png) [@damrofti](https://community.fly.io/u/damrofti)\
**Post date:** [August 29, 2022, 6:14am UTC](https://community.fly.io/t/django-migrate-command/6583/5 "2022-08-29T06:14:15Z")

</div>

I had read about this but I wanted to understand why it was happening in the SSH console first before adding the release command. Thanks for the reply.
