0

I recently deployed Django REST API project on Heroku and I wanted to remove migrations and migrate again.

I have tried:

heroku run python manage.py migrate --app cyberminds-backend zero

but it returns:

CommandError: No installed app with label 'zero'

What are the easiest steps or commands to achieve this?

jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Teshie Ethiopia
  • 586
  • 8
  • 27
  • Was zero intended as part of the command to run? If so, why is it positioned there? – jonrsharpe Mar 19 '22 at 09:24
  • @jonrsharpe as its mentioned here https://stackoverflow.com/a/54793985/18330318 `zero` is a command – Teshie Ethiopia Mar 19 '22 at 09:27
  • I see, but you're putting it after the _Heroku_ app name, hence the error you're getting, not as part of the command for Heroku to run. – jonrsharpe Mar 19 '22 at 09:28
  • @jonrsharpe where should it be placed? before app name? Honestly I can't figure this out – Teshie Ethiopia Mar 19 '22 at 09:30
  • Try `heroku run --help` to see the syntax and options. Note `--app` is an argument _to the Heroku CLI_, and **not** part of the command you want it to run in the dyno. The app name mentioned in the linked question is separate, it's not the _Heroku_ app name. – jonrsharpe Mar 19 '22 at 09:34
  • @jonrsharpe Okay, Thanks for your time. I appreciate it. – Teshie Ethiopia Mar 19 '22 at 09:39
  • 1
    @TeshAych, the `appname` mentioned in that other answer (which I wrote) refers to the [_Django_ application](https://docs.djangoproject.com/en/stable/ref/applications/). Do you remember running [`python manage.py startapp something`](https://docs.djangoproject.com/en/stable/ref/django-admin/#startapp)? It's that `something`, whatever you called your Django app. We're migrating the migrations _for one Django app_ back to zero, so you'll want something like `heroku run python manage.py migrate something zero --app cyberminds-backend`. – ChrisGPT was on strike Mar 19 '22 at 12:03
  • Depending on how your local project directory is set up, the `--app cyberminds-backend` part might not be necessary. See [How does `heroku config` know what app to use?](https://stackoverflow.com/a/50201290/354577) and [How to avoid the --app option with heroku CLI?](https://stackoverflow.com/q/55470675/354577) – ChrisGPT was on strike Mar 19 '22 at 12:08
  • @Chris now it works. Thanks for your time. I appreciate it. – Teshie Ethiopia Mar 19 '22 at 12:10

0 Answers0