1

I'm working on a big project for which I need to breakdown my application into different maintainable modules and I keep getting this error whenever I'm doing imports across different modules of the application.

django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: admin

for now I have a module named asset_herarchi and another module name db_configurations

In asset_herarchi I've the following two models:

from db_configurations.models import TableDataReferenceConfiguration

class Attribute(models.Model):
        id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
        name = models.CharField(max_length=100, blank=False, null=False)
        description = models.CharField(max_length=500, blank=True, null=True)
        table_datareference_config = models.ForeignKey(TableDataReferenceConfiguration, related_name="data_reference_where_conditions", on_delete=models.CASCADE)

class Unit(models.Model):
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
    name = models.CharField(max_length=150, blank=False, null=False)
    description = models.CharField(max_length=500, blank=True, null=True)
    formula = models.CharField(max_length=50, blank=True, null=True)

In db_configurations I've got the following model.

from asset_herarchi.models import Unit

class TableDataReferenceConfiguration(models.Model):
    id = models.UUIDField(default=uuid.uuid4, primary_key=True, editable=False)
    table_name = models.CharField(max_length=100, null=False, blank=False, unique=False)
    result_column_name = models.CharField(max_length=100, null=False, blank=False, unique=False)
    unit_of_measure = models.ForeignKey(Unit, related_name="UOM_Table_Data_Reference_Configuration", on_delete=models.SET(None) )
    behavior_rule = models.CharField(choices=Rule, null=False, blank=False, max_length=20)
    behavior_order_by = models.CharField(max_length=100, null=True, blank=True, unique=False)
    behavior_order_sorting = models.CharField(choices=Sorting, null=True, blank=True, max_length=20)

As I've mentioned earlier I'm splitting the application into different modules for easy maintenance For some business logic requirements I need to import the Unit model into the db_configurations.model file to create a relationship with TableDataReferenceConfiguration and I need to import the TableDataReferenceConfiguration model back into the asset_herarchi.models to create a relationship with Attribute model and at the same time I wish the Model TableDataReferenceConfiguration to be in a separate module for some business requirements.

Due to these imports between multiple modules I'm having the error: django.core.exceptions.ImproperlyConfigured: Application labels aren't unique, duplicates: admin

when I comment the import from anyone of the .models file the core proceeds. can someone help me with this error?

nick
  • 439
  • 1
  • 4
  • 17
  • Have a look at [this answer](https://stackoverflow.com/questions/24319558/how-to-resolve-django-core-exceptions-improperlyconfigured-application-labels). This probably what you want to see. – Sadaqatullah Noonari Oct 22 '20 at 17:39
  • Thanks @SadaqatullahNoonari , I saw that answer before asking this question that is not the problem I'm having. – nick Oct 22 '20 at 17:52

0 Answers0