我做到了这一点..无法弄清楚错误
from django.contrib.sites.models import Site
>>> site = Site.objects.create(domain='example.com', name='example.com')
但仍然有错误帮助我做什么我'我试图访问auth_views.login和admin
python shell错误..
C:\Users\MOIZ\Desktop\theme\fproject\fproject>python mannage.py runserver
python: can't open file 'mannage.py': [Errno 2] No such file or directory
C:\Users\MOIZ\Desktop\theme\fproject\fproject>python manage.py shell
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 18:11:49) [MSC v.1900 64 bit (AMD64)]
on win32
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.contrib.sites.models import Site
>>> Site.objects.create(name='example.com',domain='example.com')
Traceback (most recent call last):
File "C:\Users\MOIZ\Desktop\theme\fproject\fproject\env\lib\site-packages\djan
go\db\backends\utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "C:\Users\MOIZ\Desktop\theme\fproject\fproject\env\lib\site-packages\djan
go\db\backends\sqlite3\base.py", line 328, in execute
return Database.Cursor.execute(self, query, params)
sqlite3.IntegrityError: UNIQUE constraint failed: django_site.domain
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "C:\Users\MOIZ\Desktop\theme\fproject\fproject\env\lib\site-packages\djan
go\db\models\manager.py", line 85, in manager_method