Site compliance request does not exist

Python noob, as this is my first project, so excuse my unfamiliarity.

The site worked very well until I clicked "log out" in my application. After that, the site will give me this error: DoesNotExist at / login / The site compliance request does not exist.

I searched everywhere, and the only solution I get is related to setting the site structure, SITE_ID, etc. I think these items are fine on my computer, but I can't find a walkthrough / guide to help me check them out.

Can someone tell me what the problem is and how to fix it? Thanks in advance: 3

DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. 'NAME': '/home/dotcloud/nhs.db', # Or path to database file if using sqlite3. 'USER': '', # Not used with sqlite3. 'PASSWORD': '', # Not used with sqlite3. 'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'PORT': '', # Set to empty string for default. Not used with sqlite3. } 

}

+58
python django
Aug 05 2018-12-12T00:
source share
6 answers

If you do not have a site defined in your database and django wants to link to it, you will need to create it.

From python manage.py shell :

 from django.contrib.sites.models import Site new_site = Site.objects.create(domain='foo.com', name='foo.com') print (new_site.id) 

Now set this site id in settings.py to SITE_ID

+142
Aug 05 '12 at 5:45
source share

The django_site table should contain a row with the same value as id (the default is 1 ) for which SITE_ID set (inside your settings.py ).

+28
Jan 17 '13 at 21:49
source share

I fixed this without using python manage.py shell

First I tried using the commands above using the manage.py command:

 from django.contrib.sites.models import Site new_site = Site.objects.create(domain='foo.com', name='foo.com') print(new_site.id) 

But he betrayed the ERROR OF INTEGRITY

The short answer is: add SITE_ID = 1 to the settings.py file. If you want to find out what your site identifier is and then go to the actual database, I downloaded sqliteman to see what is behind the table. Thus, any site identifier that you have in the table is assigned SITE_ID

This is because there is a get_current function that searches for SITE_ID and does not find it in your settings.py

 tables -django_site --Columns ---id 

it must have identifier 1, name as example.com , domain as example.com

+2
Dec 06 '17 at 11:31 on
source share

I see the answers to create a new site and a link identifier for this. But if you already have a site or you somehow deleted and re-created the site from the user interface, then the identifier continues to increase. To solve this problem, you can get the identifier as follows:

 python manage.py shell from django.contrib.sites.models import Site print(Site.objects.get(name='example.com').id) 

Get the identifier you got here in setting.py . For example.

 SITE_ID = 8 

Basically, the ID in the table corresponding to your travel site and in settings.py should match.

+1
Feb 06 '18 at 7:23
source share

Add SITE_ID = 1 to settings.py in your django project

+1
Feb 01 '19 at 11:22
source share

enter image description here

Request the identifier in the django_site tables in your database and set the correct one in your settings.py file, for example: SITE_ID = 3

0
Apr 01 '19 at 8:55 am
source share



All Articles