Opened 8 years ago

Last modified 8 years ago

#26770 closed Cleanup/optimization

Migrations on app named 'settings' fails — at Initial Version

Reported by: Louis Lang Owned by: nobody
Component: Migrations Version: 1.9
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

This seems to be a trivial issue that is reasonably resolved by simply renaming the settings application (an app that I created). However, given that the migrations file (snippet below) was generated by Django and the imports clobber one another it seems reasonable enough consider this a bug.

# -*- coding: utf-8 -*-
# Generated by Django 1.9.7 on 2016-06-17 03:12
from __future__ import unicode_literals
 
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import settings.models

This results in the following error message:

Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 89, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 20, in __init__
    self.loader = MigrationLoader(self.connection)
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 49, in __init__
    self.build_graph()
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 170, in build_graph
    self.load_disk()
  File "/home/user/Projects/shop/venv/local/lib/python2.7/site-packages/django/db/migrations/loader.py", line 105, in load_disk
    migration_module = import_module("%s.%s" % (module_name, migration_name))
  File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/user/Projects/shop/settings/migrations/0001_initial.py", line 11, in <module>
    class Migration(migrations.Migration):
  File "/home/user/Projects/shop/settings/migrations/0001_initial.py", line 16, in Migration
    migrations.swappable_dependency(settings.AUTH_USER_MODEL),
AttributeError: 'module' object has no attribute 'AUTH_USER_MODEL'

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top