(venv) PS C:\django-sites\testsite> python manage.py makemigrations
System check identified some issues:
WARNINGS: ?: (urls.W005) URL namespace 'admin' isn't unique. You may not be able to reverse all URLs in this namespace No changes detected
(venv) PS C:\django-sites\testsite>
deleted every line in path('admin/', admin.site.urls),
my code:
from django.db import models
class News(models.Model):
title = models.CharField(max_length=150)
content = models.TextField(blank=True)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
photo = models.ImageField(upload_to='photos/%Y/%m/%d/')
is_published = models.BooleanField(default=True)
#id - INT
#title - Varchar
#content - Text
#createrd_at - DateTime
#updated_at - DateTime
#photo - Image
#is_published - Boolean
CodePudding user response:
Delete the migrations folder, to create initial migrations for an app, run makemigrations and specify the app name. The migrations folder will be created.
In your case it would be:
python manage.py makemigrations news
And of course, your app must be included in INSTALLED_APPS inside settings.py ( news.apps.NewsConfig )
CodePudding user response:
I didn't see all of your urls.py files, but what I'm sure is it's because of multiple declarations of that admin path!
Remove the extra " path('admin/', admin.site.urls) " line from all urls.py files except the project's url.py and it should work.