This is in Django 2.0 , python 3.6.5
I have an app called posts, and I changed models.py to a folder structure,
i.e., create a directory models and move the file models.py insid. Also
config __ init__.py file, as explained next. The project runs ok, but my
test suite fails.
In my settings, installed apps i have the app as:
'myproject.apps.posts.apps.PostsConfig'
My app config (posts/apps.py)
from django.apps import AppConfigclass PostsConfig(AppConfig):
name = 'posts'
verbose_name = 'posts'
I have move posts/models.py to a directory structure. So I have
posts/models/models.py
posts/models/proxymodels.py
posts/models/__init__.py
inside models/__ init__.py I do import my models as explained in doc
from .models import Jobfrom .proxys import ActiveJob
The project works well, but when trying to run tests:
python manage.py test
I have this error:
RuntimeError: Model class tektank.apps.posts.models.models.Job doesn't declare
an explicit app_label and isn't in an application in INSTALLED_APPS.
The model is a normal one, with fields, nothing extrange. The thing is that
if I declare in the meta
class Meta:
app_label = 'posts'
I got the following error:
RuntimeError: Conflicting 'job' models in application 'posts': <class
'posts.models.models.Job'> and <class 'tektank.apps.posts.models.models.Job'>.
Note: If I use pytest, I run the command:
pytest
It runs OK
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/e1ff18f4-daca-4e5e-94e0-d0dce9d71306%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.