Tuesday, September 23, 2014

Re: updating site domain with data migration

Markus, one specific question re your blog post.

"What happens when you call python manage.py makemigrations? First of all, since no apps are given, Django reads the migrations from all apps listed in INSTALLED_APPS. In our case, this is ('author', 'book',)

I have the following in INSTALLED_APPS:

In [2]: apps.get_app_configs()
Out[2]: ValuesView(OrderedDict([('admin', <AdminConfig: admin>), ('auth', <AuthConfig: auth>), ('contenttypes', <ContentTypesConfig: contenttypes>), ('sessions', <SessionsConfig: sessions>), ('messages', <MessagesConfig: messages>), ('staticfiles', <StaticFilesConfig: staticfiles>), ('sites', <SitesConfig: sites>), ('allauth', <AppConfig: allauth>), ('account', <AccountConfig: account>), ('socialaccount', <SocialAccountConfig: socialaccount>), ('main', <MainConfig: main>)]))

But it seems it doesn’t see my “main” app. Your note seems to indicate that it will ‘make migrations’ for INSTALLED_APPS.

$ python manage.py migrate --list
admin
 [ ] 0001_initial
auth
 [ ] 0001_initial
contenttypes
 [ ] 0001_initial
sessions
 [ ] 0001_initial
sites
 [ ] 0001_initial
socialaccount
 (no migrations)

I have to explicitly run with ‘main’ app. Just wondering if I am missing something in my config.

$ python manage.py makemigrations main
Migrations for 'main':
  0001_initial.py:
    - Create model Currencies
    - Create model Locations
    - Create model Posts
    - Create model UserProfile


On Sep 22, 2014, at 9:16 AM, Markus Holtermann <info@markusholtermann.eu> wrote:

On Mon, Sep 22, 2014 at 08:41:36AM -0700, Anil Jangity wrote:
If I don't use syncdb, I should also create the super user account
using data migration? If so, it seems like I need to go do
User.objects.create_superuser().

There still is the option of running "python manage.py createsuperuser"
after the migrations are applied. If I don't need a superuser account
during the migration, this would be my way of doing it.

/Markus

No comments:

Post a Comment