3

I have just created my first Django app which uses a Postgres database... which was working until I broke it by trying to rename it. I only have placeholder data in the database, and so I am not concerned about database migration, I simply want to get my app working again and with an empty database is just fine. I found this question on here: How to change the name of a Django app? which lays out the steps involved in re-naming a Django app. I have done the first two which are to 1) Rename the folder found in the project root and 2) change any references to the app in its dependencies, i.e. the app's views, the urls.py and settings.py files.

As a newbie to Django and programming, the third step is not clear to me. The instructions were to:

"Edit the database table django_content_type with the following command: UPDATE django_content_type SET app_label='' WHERE app_label='' Note: for renaming models, you'll need to change django_content_type.name"

So I have two very specific questions:

1) Where/how do I edit the database table? As in, where do I physically type this command? And/or how do I change the "django_content_type.name"?

2) I have already pushed my project to Heroku and have a working version of my app there. What will I need to do on the Heroku side to handle this change?

Thanks in advance for your patience!

Community
  • 1
  • 1
jac300
  • 5,182
  • 14
  • 54
  • 89
  • 1
    Just a suggestion, but if you have only placeholder data in the database, why not just drop all of the tables and perform a `python manage.py syncdb` again? – themanatuf May 29 '13 at 15:22
  • ah. smart. so many steps involved in getting this thing running and I forgot that I could just do that. thanks. – jac300 May 29 '13 at 15:25
  • any advice on how to do that on the heroku side? – jac300 May 29 '13 at 15:43
  • Sorry, I've never worked with that before :/ But I'm assuming you got it since you marked a solution? – themanatuf May 29 '13 at 15:46

1 Answers1

4

You need to go to the database table manually, or use dbshell.

> ./manage.py dbshell #opens the database command line.

This places you in the command line

$> UPDATE django_content_type SET app_label='<new_label>' WHERE app_label='<old_label>'
$> <ctrl>-D

This is make you all set. You dont need to do anything else on the heroku side apart from this change.

karthikr
  • 97,368
  • 26
  • 197
  • 188