Problem at activating the admin site (Django tutorial part 2)

91 views
Skip to first unread message

pasztilla

unread,
Aug 25, 2011, 9:29:33 AM8/25/11
to Django users
Hi there,
I'm just trying to accomodate myself with Django - and so I tried to
go through the Django Tutorial from the Django official site. There
went everything ok with part 1, but at the very beginning of the part
2 I've met a problem(https://docs.djangoproject.com/en/1.3/intro/
tutorial02). In spite of that I've perform all settings/changes
described in the 'Activate the admin site' section going to the next
section 'Start the development server' (ie. 127.0.0.1:8000/admin/) led
merely to an error message:

"DoesNotExist at /admin/
Site matching query does not exist.
Request Method:
GET
Request URL:
http://127.0.0.1:8000/admin/
Django Version:
1.3

Exception Type:
DoesNotExist

Exception Value:
Site matching query does not exist.


Exception Location:

D:\Python27\lib\site-packages\django\db\models\query.py in get, line
349

Python Executable:
D:\Python27\python.exe

Python Version:
2.7.1"

[...]
and something more:

"Settings
Using settings module mysite.settings

Setting
Value

USE_L10N
True

USE_THOUSAND_SEPARATOR
False

LANGUAGE_CODE
'en-us'

ROOT_URLCONF
'mysite.urls'


MANAGERS
()

DEFAULT_CHARSET
'utf-8'

STATIC_ROOT
''

TEST_DATABASE_CHARSET
None

MESSAGE_STORAGE
'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'

DATABASE_HOST
''

IGNORABLE_404_STARTS
('/cgi-bin/', '/_vti_bin', '/_vti_inf')

SEND_BROKEN_LINK_EMAILS
False

URL_VALIDATOR_USER_AGENT
'Django/1.3 (http://www.djangoproject.com)'

STATICFILES_FINDERS
('django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder')

SESSION_COOKIE_DOMAIN
None

SESSION_COOKIE_NAME
'sessionid'

COMMENTS_MODERATORS_GROUP
None

TIME_INPUT_FORMATS
('%H:%M:%S', '%H:%M')

DATABASES
{'default': {'ENGINE': 'django.db.backends.sqlite3',
'HOST': '',
'NAME': 'D:/.../mysite/sqlite3.db',
'OPTIONS': {},
'PASSWORD': '********************',
'PORT': '',
'TEST_CHARSET': None,
'TEST_COLLATION': None,
'TEST_MIRROR': None,
'TEST_NAME': None,
'TIME_ZONE': 'Europe/Budapest',
'USER': ''}}


TEST_DATABASE_NAME
None

FILE_UPLOAD_PERMISSIONS
None

FILE_UPLOAD_HANDLERS
('django.core.files.uploadhandler.MemoryFileUploadHandler',
'django.core.files.uploadhandler.TemporaryFileUploadHandler')

DEFAULT_CONTENT_TYPE
'text/html'

APPEND_SLASH
True

FIRST_DAY_OF_WEEK
0

DATABASE_ROUTERS
[]

YEAR_MONTH_FORMAT
'F Y'

STATICFILES_STORAGE
'django.contrib.staticfiles.storage.StaticFilesStorage'

CACHES
{'default': {'BACKEND':
'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': ''}}

SERVER_EMAIL
'root@localhost'

SESSION_COOKIE_PATH
'/'

IGNORABLE_404_ENDS
('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico',
'.php')


MIDDLEWARE_CLASSES
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')

USE_I18N
True

THOUSAND_SEPARATOR
','

SECRET_KEY
'********************'

LANGUAGE_COOKIE_NAME
'django_language'

FILE_UPLOAD_TEMP_DIR
None

TRANSACTIONS_MANAGED
False

LOGGING_CONFIG
'django.utils.log.dictConfig'

TEMPLATE_LOADERS
('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader')

TEMPLATE_DEBUG
True

AUTHENTICATION_BACKENDS
('django.contrib.auth.backends.ModelBackend',)

TEST_DATABASE_COLLATION
None

FORCE_SCRIPT_NAME
None

CACHE_BACKEND
'locmem://'

SESSION_COOKIE_SECURE
False

CSRF_COOKIE_DOMAIN
None

FILE_CHARSET
'utf-8'

DEBUG
True

SESSION_FILE_PATH
None

DEFAULT_FILE_STORAGE
'django.core.files.storage.FileSystemStorage'

INSTALLED_APPS

['django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'polls',
'django.contrib.admin']

LANGUAGES
(('ar', 'Arabic'),
('az', 'Azerbaijani'),
('bg', 'Bulgarian'),
('bn', 'Bengali'),
('bs', 'Bosnian'),
('ca', 'Catalan'),
('cs', 'Czech'),
('cy', 'Welsh'),
('da', 'Danish'),
('de', 'German'),
('el', 'Greek'),
('en', 'English'),
('en-gb', 'British English'),
('es', 'Spanish'),
etc.)

DATABASE_ENGINE
''

DATABASE_NAME
''

COMMENTS_FIRST_FEW
0

PREPEND_WWW
False

SESSION_COOKIE_HTTPONLY
False

DATABASE_PORT
''

DEBUG_PROPAGATE_EXCEPTIONS
False

MONTH_DAY_FORMAT
'F j'

LOGIN_URL
'/accounts/login/'

SESSION_EXPIRE_AT_BROWSER_CLOSE
False

TIME_FORMAT
'P'

DATE_INPUT_FORMATS

('%Y-%m-%d',
'%m/%d/%Y',
'%m/%d/%y',
'%b %d %Y',
'%b %d, %Y',
'%d %b %Y',
'%d %b, %Y',
'%B %d %Y',
'%B %d, %Y',
'%d %B %Y',
'%d %B, %Y')


CSRF_COOKIE_NAME
'csrftoken'

EMAIL_HOST_PASSWORD
'********************'

PASSWORD_RESET_TIMEOUT_DAYS
'********************'

CACHE_MIDDLEWARE_ALIAS
'default'

SESSION_SAVE_EVERY_REQUEST
False

ADMIN_MEDIA_PREFIX
'/static/admin/'

NUMBER_GROUPING
0


SESSION_ENGINE
'django.contrib.sessions.backends.db'

CSRF_FAILURE_VIEW
'django.views.csrf.csrf_failure'

COMMENTS_SKETCHY_USERS_GROUP
None

LOGIN_REDIRECT_URL
'/accounts/profile/'

LOGGING
{'disable_existing_loggers': False,
'handlers': {'mail_admins': {'class':
'django.utils.log.AdminEmailHandler',
'level': 'ERROR'}},
'loggers': {'django.request': {'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': True}},
'version': 1}


CACHE_MIDDLEWARE_KEY_PREFIX
''

LOCALE_PATHS
()

TEMPLATE_STRING_IF_INVALID
''

COMMENTS_ALLOW_PROFANITIES
False

LOGOUT_URL
'/accounts/logout/'

EMAIL_USE_TLS
False

TEMPLATE_DIRS
()

FIXTURE_DIRS
()

EMAIL_HOST
'localhost'

DATE_FORMAT
'N j, Y'

MEDIA_ROOT
''
ADMINS
()

FORMAT_MODULE_PATH
None

DEFAULT_FROM_EMAIL
'webmaster@localhost'

STATICFILES_DIRS
()

MEDIA_URL
''

DATETIME_FORMAT
'N j, Y, P'

EMAIL_SUBJECT_PREFIX
'[Django] '

SITE_ID
1

DISALLOWED_USER_AGENTS
()

ALLOWED_INCLUDE_ROOTS
()

DECIMAL_SEPARATOR
'.'

SHORT_DATE_FORMAT
'm/d/Y'

DATABASE_USER
''

TEST_RUNNER
'django.test.simple.DjangoTestSuiteRunner'

TIME_ZONE
'Europe/Budapest'


FILE_UPLOAD_MAX_MEMORY_SIZE
2621440

EMAIL_BACKEND
'django.core.mail.backends.smtp.EmailBackend'

DEFAULT_TABLESPACE
''

TEMPLATE_CONTEXT_PROCESSORS
('django.contrib.auth.context_processors.auth',
'django.core.context_processors.debug',
'django.core.context_processors.i18n',
'django.core.context_processors.media',
'django.core.context_processors.static',
'django.contrib.messages.context_processors.messages')

SESSION_COOKIE_AGE
1209600

SETTINGS_MODULE
'mysite.settings'

USE_ETAGS
False

LANGUAGES_BIDI
('he', 'ar', 'fa')

DEFAULT_INDEX_TABLESPACE
''

INTERNAL_IPS
()

STATIC_URL
'/static/'

EMAIL_PORT
25

SHORT_DATETIME_FORMAT
'm/d/Y P'

ABSOLUTE_URL_OVERRIDES
{}

DATABASE_OPTIONS
{}

CACHE_MIDDLEWARE_SECONDS
600

BANNED_IPS
()

DATETIME_INPUT_FORMATS
('%Y-%m-%d %H:%M:%S',
'%Y-%m-%d %H:%M',
'%Y-%m-%d',
'%m/%d/%Y %H:%M:%S',
'%m/%d/%Y %H:%M',
'%m/%d/%Y',
'%m/%d/%y %H:%M:%S',
'%m/%d/%y %H:%M',
'%m/%d/%y')

DATABASE_PASSWORD
'********************'

ADMIN_FOR
()

COMMENTS_BANNED_USERS_GROUP
None

EMAIL_HOST_USER
''

PROFANITIES_LIST
'********************'
"

So, does anybody have an idea what could be wrong? Thanks for your
attention and help(eventually) in advance!
Yours sincerelly,
Pászkán Attila

raj

unread,
Aug 25, 2011, 10:31:59 AM8/25/11
to Django users
In ur urls.py,
Did u import admin, make it discoverable, and also uncomment the /
admin/ url?
Also, make sure that you syncdb by running python manage.py syncdb.
Lemme know if that helps :)

Babatunde Akinyanmi

unread,
Aug 25, 2011, 10:35:59 AM8/25/11
to django...@googlegroups.com
Please say exactly what you did. It will be easier to help that way

> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

--
Sent from my mobile device

Babatunde Akinyanmi

unread,
Aug 25, 2011, 10:37:56 AM8/25/11
to django...@googlegroups.com
The error you stated normally happens when there are problems with the
django_site table created when you start a project.

Pászkán Attila

unread,
Aug 25, 2011, 12:53:22 PM8/25/11
to django...@googlegroups.com

Yes, all these actions (*) I have done already, but they didn't help... :-(

(*): in .../mysite/urls.py I have uncommented:

         from django.contrib import admin
         admin.autodiscover()
 
         and further among urlpatterns I've uncommented:
         url(r'^admin/', include(admin.site.urls)),

     in .../mysite/settings.py:
 
         among INSTALLED_APPS I've uncommented the line containing:
         'django.contrib.admin'

     then performed: >python manage.py syncdb

   PA

then performed: >python manage.py syncdb

PA

 


 
2011/8/25 raj <nano....@gmail.com>

Pászkán Attila

unread,
Aug 25, 2011, 12:56:05 PM8/25/11
to django...@googlegroups.com
Can you give more details? 


 
2011/8/25 Babatunde Akinyanmi <tunde...@gmail.com>

Babatunde Akinyanmi

unread,
Aug 25, 2011, 1:28:54 PM8/25/11
to django...@googlegroups.com
Hi paszkan,
First I want you to go to your settings file and tell me what value is
specified for SITE_ID. You will need that value for the next step.

In your terminal where you would have typed "python manage.py
runserver" type "python manage.py shell"

Doing that would load django's inbuilt shell.

Next type:
"from django.contrib.sites.models import Site"
If there's no error type this is where you would need the SITE_ID
setting value. Assuming SITE_ID value is 1 then type:
"Site.objects.get(id=1)"

Do this and give feed back

pasztilla

unread,
Aug 25, 2011, 5:50:39 PM8/25/11
to Django users
Hi Babatunde,

Hi Babatunde,



SITE_ID == 1



then I did what you've suggested:(see the result)



Microsoft Windows [verziószám: 6.1.7601]

Copyright (c) 2009 Microsoft Corporation.
Minden jog fenntartva.



C:\Users\Pászkán Attila>


D:\>cd Atilla\Programoz\Django\Gyakorlaas\mysite


D:\Atilla\Programoz\Django\Gyakorlaas\mysite>python manage.py shell


Python 2.7.1 (r271:86832, Feb 7 2011, 11:30:38)[MSC v.1500 32 bit
(Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)


>>> from django.contrib.sites.models import Site

>>> Site.objects.get(id=1)


Traceback (most recent call last):

File "<console>", line 1, in <module>

File "D:\Python27\lib\site-packages\django\db\models\manager.py",
line 132, in get

return self.get_query_set().get(*args, **kwargs)

File "D:\Python27\lib\site-packages\django\db\models\query.py", line
349, in get

% self.model._meta.object_name)

DoesNotExist: Site matching query does not exist.


>>>





!!!! +++++ !!!!

Meanwhile came an idea that this error could have slyly,
somehow undercover, something to do with my User Name (under Windows)
which contains some unusual characters (two á-s, see above) ...
I've set up a new user (without unusual characters)
and repeated the whole procedure (building up an application
according to the tutorial) and it worked fine!!! :-)


So, seemingly the problem has been resolved! :-)
(It would be interesting to find out why and how
has influenced that unusual user name the functioning
of my admin-site...but it is maybee to much effort to investigate)

Anyway, thanks for your efforts and support!

PA


On aug. 25, 19:28, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
> Hi paszkan,
> First I want you to go to your settings file and tell me what value is
> specified for SITE_ID. You will need that value for the next step.
>
> In your terminal where you would have typed "python manage.py
> runserver" type "python manage.py shell"
>
> Doing that would load django's inbuilt shell.
>
> Next type:
> "from django.contrib.sites.models import Site"
> If there's no error type this is where you would need the SITE_ID
> setting value. Assuming SITE_ID value is 1 then type:
> "Site.objects.get(id=1)"
>
> Do this and give feed back
>
> On 8/25/11, Pászkán Attila <paszti...@gmail.com> wrote:
>
>
>
> > Can you give more details?
>
> > 2011/8/25 Babatunde Akinyanmi <tundeba...@gmail.com>
>
> >> The error you stated normally happens when there are problems with the
> >> django_site table created when you start a project.
>
> >> On 8/25/11, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
> >> > Please say exactly what you did. It will be easier to help that way
>
> ...
>
> tovább »

Babatunde Akinyanmi

unread,
Aug 25, 2011, 6:20:14 PM8/25/11
to django...@googlegroups.com
Cool. I'm really interested in finding out what went wrong. If you are
also, try to recreate the problem by using you former username and see
if the problem persists. If it does, its a bug that the community
could consider fixing. That error was thrown by the Site app so I'm
still wondering how a change in user name was able to solve it

pasztilla

unread,
Sep 11, 2011, 6:00:32 PM9/11/11
to Django users
Hi Babatunde,

1. sorry for the delayed answer - but I was in the last three weeks
far from any possibility to use the Internet (and Django as well)...
2. I have tried to reproduce the phenomenon and with the 'Pászkán
Attila' as user it worked ! Why? - still it isn't clear.

PA

On Aug 26, 12:20 am, Babatunde Akinyanmi <tundeba...@gmail.com> wrote:
> Cool. I'm really interested in finding out what went wrong. If you are
> also, try to recreate the problem by using you former username and see
> if the problem persists. If it does, its a bug that the community
> could consider fixing. That error was thrown by the Site app so I'm
> still wondering how a change in user name was able to solve it
>
> ...
>
> read more »

Babatunde Akinyanmi

unread,
Sep 12, 2011, 1:11:30 AM9/12/11
to django...@googlegroups.com
It isn't clear to me also. Initially I was surprised because the site
app doesn't have any dependency on django's user system. Even if it
does, django uses unicode which caters for those characters in your
name.
Well.....at least we are sure the problem wsnt from the user name. But
something definetely went wrong. Don't worry about it though

Ravi Shakya

unread,
May 18, 2012, 4:58:50 AM5/18/12
to django...@googlegroups.com
I am also facing the exact problem indicated by pasztilla.
My usernaleme thing is fine (normal) but I have not been able to fix this issue.
Any concrete cause/solution to this?
Message has been deleted

Karen Tracey

unread,
Dec 13, 2012, 9:45:06 PM12/13/12
to django...@googlegroups.com
Have you followed the tutorial exactly? I was unable to recreate this problem when someone opened a trac ticket describing it:

https://code.djangoproject.com/ticket/18308

Another Django dev noted it was a duplicate of another ticket:

https://code.djangoproject.com/ticket/18226

where the problem seemed to be due to adding south as an app in the tutorial rather than following the tutorial exactly.

Karen
--
http://tracey.org/kmt/

Reply all
Reply to author
Forward
0 new messages