Django 1.7 Application stickers are not unique, duplicates foo

I had a problem with Django 1.7 to do this with the new App Registry, with a specific deployment. I usually deleted the instance and recreated it, however it continues to happen when I destroyed the instance.

This is always a product application that causes this error, and I used the app.py file to change the label to sc_products, however now all that sc_products is already defined, too.

In this particular example, I am trying to port an application.

Running migrations: Applying sc_products.0001_initial...Traceback (most recent call last): File "manage.py", line 9, in <module> execute_from_command_line(sys.argv) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 377, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/core/management/base.py", line 288, in run_from_argv self.execute(*args, **options.__dict__) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/core/management/base.py", line 338, in execute output = self.handle(*args, **options) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 160, in handle executor.migrate(targets, plan, fake=options.get("fake", False)) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 63, in migrate self.apply_migration(migration, fake=fake) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 91, in apply_migration if self.detect_soft_applied(migration): File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/db/migrations/executor.py", line 135, in detect_soft_applied apps = project_state.render() File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/db/migrations/state.py", line 57, in render self.apps = Apps([AppConfigStub(label) for label in sorted(self.real_apps + list(app_labels))]) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/apps/registry.py", line 56, in __init__ self.populate(installed_apps) File "/home/savingschampion/.virtualenvs/savings_champion/local/lib/python2.7/site-packages/django/apps/registry.py", line 89, in populate "duplicates: %s" % app_config.label) django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: sc_products 

I already do the following answer from there:

How to resolve "django.core.exceptions.ImproperlyConfigured: application labels are not unique, duplicates: foo" in Django 1.7?

+5
source share
2 answers

I had the same problem and I just stumbled upon this. After a bit of django debugging, I may have a long-awaited answer.

This is most likely due to the fact that your application is ultimately processed both unmigrated and migrated at the same time (thus creating the same error even when you change the application label), and this takes place in turn because your application has both old (south) migrations and new style migrations (django).

The best and easiest way to handle this is to start a new one. Remove all numbered migrations (e.g. rm migrations/0???_*.py* ) and call manage.py makemigrations again, ensuring that only django migrations remain and are updated.

+2
source

Check your INSTALLED_APPS. I accidentally turned on the same application twice and had a similar error.

+1
source

Source: https://habr.com/ru/post/1208070/


All Articles