-
Notifications
You must be signed in to change notification settings - Fork 53
Open
Description
python=3.8
django=3.1.5
djangorestframework=3.12.2
Using docker image and docker-compose file. Docker-compose file at the following.
my_api:
container_name: 'my_api'
build: .
command: export DJANGO_SETTINGS_MODULE=core.settings &&
python manage.py collectstatic --noinput &&
python manage.py migrate --noinput &&
architect partition --module my_app.models &&
/start.sh"
ports:
- "8000:80"
architect command raise exception;
Traceback (most recent call last):
my_api | File "/usr/local/bin/architect", line 8, in <module>
my_api | sys.exit(main())
my_api | File "/usr/local/lib/python3.8/site-packages/architect/commands/__init__.py", line 93, in main
my_api | commands[command]['parser'].result(args.func(vars(args)))
my_api | File "/usr/local/lib/python3.8/site-packages/architect/commands/partition.py", line 26, in run
my_api | module_clss = filter(lambda obj: isinstance(obj, type), __import__(module, fromlist=module).__dict__.values())
my_api | File "/code/my_app/models.py", line 5, in <module>
my_api | class DepartmentModel(models.Model):
my_api | File "/usr/local/lib/python3.8/site-packages/django/db/models/base.py", line 113, in __new__
my_api | raise RuntimeError(
my_api | RuntimeError: Model class my_app.models.DepartmentModel doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
structure is standart
my_app
-> models.py
core
-> settings.py
settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
"django_filters",
"rest_framework",
"polymorphic",
"django_cleanup",
"drf_yasg",
"my_app"
]
models.py
class DepartmentModel(models.Model):
name = models.CharField(max_length=255, unique=True, verbose_name=_('Department'))
class Meta:
verbose_name = _('Department')
verbose_name_plural = _('Departments')
#app_label = 'my_app'
def __str__(self):
return self.name
if I add app_label in to Meta class, is working, otherwise raise exception. WHY!!
Metadata
Metadata
Assignees
Labels
No labels