1
  DoesNotExist at /admin/login/

Site matching query does not exist.

Request Method:     GET
Request URL:    https://tehb123.pythonanywhere.com/admin/login/?next=/admin/
Django Version:     1.9.3
Exception Type:     DoesNotExist
Exception Value:    

Site matching query does not exist.

Exception Location:     /usr/local/lib/python3.5/dist-packages/django/db/models/query.py in get, line 387
Python Executable:  /usr/local/bin/uwsgi
Python Version:     3.5.1
Python Path:    

['/var/www',
 '.',
 '',
 '/home/tehb123/.local/lib/python3.5/site-packages',
 '/var/www',
 '/usr/lib/python3.5',
 '/usr/lib/python3.5/plat-x86_64-linux-gnu',
 '/usr/lib/python3.5/lib-dynload',
 '/usr/local/lib/python3.5/dist-packages',
 '/usr/lib/python3/dist-packages',
 '/home/tehb123/mysite']

Server time:    Thu, 13 Oct 2016 05:34:55 +0000
  • urls

    from django.conf.urls import url, patterns, include
    from django.contrib import admin
    from django.contrib.flatpages import views
    
    
    urlpatterns = [
      url(r'^admin/', admin.site.urls),
      url(r'^', include('Mysitez.urls')),
      # url(r'^pages/', include('django.contrib.flatpages.urls')),
    ]
    
    urlpatterns += [
       url(r'^(?P<url>.*/)$', views.flatpage),
    ]
    
  • settings

    INSTALLED_APPS = [
      'django.contrib.admin',
      'django.contrib.auth',
      'django.contrib.contenttypes',
      'django.contrib.sessions',
      'django.contrib.messages',
      'django.contrib.staticfiles',
      'django.templatetags',
      'django.apps',
      'django.contrib.sites',
      'django.contrib.flatpages',
      'Mysitez',
    ]
    
Reema Parakh
  • 1,347
  • 3
  • 19
  • 46
djt111
  • 63
  • 1
  • 8

3 Answers3

4

SITE_ID=1 in setting and all work, but why? not have idae =(

djt111
  • 63
  • 1
  • 8
2

I found the solution in this other post:

"You don't really need the sites framework if you only run one site from the project, so the easiest fix would be to remove the following item from your INSTALLED_APPS and the error should go away:

'django.contrib.sites'

"

Community
  • 1
  • 1
juminet
  • 437
  • 1
  • 5
  • 12
0

The admin site

once you create the project with django version > 1.6 , the admin site will enable django itself. but make sure you have following ["https://docs.djangoproject.com/en/1.10/ref/contrib/admin/"], once you create project , make python manage.py migrate then create the admin user using (python manage.py createsuperuser ). do the run command see the url like ("http://127.0.0.1:8000/admin/") you can see the login page