RuntimeError, Conflicting 'product' models and also RuntimeError: app_label

I’m getting error:

  File "/home/pi/PROJECTS/mysite29/mysite/mysite/users/", line 6, in <module>
    from products.models import Product
  File "/home/pi/PROJECTS/mysite29/mysite/mysite/products/", line 4, in <module>
    class Product(models.Model):
  File "/home/pi/.virtualenvs/mysite29/lib/python3.9/site-packages/django/db/models/", line 113, in __new__
    raise RuntimeError(
RuntimeError: Model class products.models.Product doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.

So I put this in my Product model:

	class Meta:
		app_label = "mysite.products"

The error changes to:

  File "/home/pi/PROJECTS/mysite29/mysite/mysite/products/", line 4, in <module>
    class Product(models.Model):
  File "/home/pi/.virtualenvs/mysite29/lib/python3.9/site-packages/django/db/models/", line 321, in __new__
    new_class._meta.apps.register_model(new_class._meta.app_label, new_class)
  File "/home/pi/.virtualenvs/mysite29/lib/python3.9/site-packages/django/apps/", line 228, in register_model
    raise RuntimeError(
RuntimeError: Conflicting 'product' models in application 'mysite.products': <class 'products.models.Product'> and <class 'mysite.products.models.Product'>.

I just can’t work out the right combination of the path namespace in the base, the installed app in settings, the app_name in and the in the to get it working.

My main has:

from mysite.products.views import ProductListView

urlpatterns = [
    path('discover/', ProductListView.as_view(), name="discover"),
    path("p/", include("mysite.products.urls", namespace="products")),

My products app is:

from django.urls import path
from .views import ProductDetailView

app_name = "products"
#app_name =

urlpatterns = [
	path("<slug>/", ProductDetailView.as_view(), name="product-detail"),

The in the products app is:

from django.views import generic
#from django.views.generic import ListView, DetailView
from .models import Product

class ProductListView(generic.ListView):
	template_name = "discover.html"
	queryset = Product.objects.all()

class ProductDetailView(generic.DetailView):
	template_name = "products/product.html"
	queryset = Product.objects.all()

My settings file has:


my has:

from django.db import models

class Product(models.Model):
	name = models.CharField(max_length=100)
	description = models.TextField()
	cover = models.ImageField(blank=True, null=True, upload_to="product_covers/")
	slug = models.SlugField()
	content_url = models.URLField(blank=True, null=True)
	content_file = models.FileField(blank=True, null=True)
	price = models.PositiveIntegerField(default=100)

	# class Meta:
		# app_label = "mysite.products"
	def __str__(self):

my is:

from django.apps import AppConfig

class ProductsConfig(AppConfig):
#    default_auto_field = 'django.db.models.BigAutoField'
    name = "mysite.products"
    #name = "products"

I’m using django cookiecutter and it seems like it would be straight forward to copy the same way the users app is set up however I still get the app_name error. I tried a bunch of combinations over a few days and looked on stack overflow and youtube, and I’m not getting the same results with the way other people put their settings. Can you see which section is causing the conflict? Thanks

I got it working.
The default users app for cookiecutter was registered in as:
Instead of:

It seems this still worked until I referenced the mysite.products.models.Product model in the mysite.users.models, now that both the users and products apps are registered in the full way like this it works: