List Info

Thread: admin interface startup problems




admin interface startup problems
user name
2007-12-25 17:46:54
Following the book, with today's svn checkout of django and
a few
necessary adjustments, I've gotten things to work until page
84, where
I'm stuck in multiple ways. Help greatly appreciated.

Trying to visit the admin site in Firefox I get

    AttributeError at /admin/
    'WSGIRequest' object has no attribute 'user'
    Request Method: 	GET
    Request URL: 	http://127.0.0.1:8000/ad
min/
    Exception Type: 	AttributeError
    Exception Value: 	'WSGIRequest' object has no attribute
'user'
    Exception Location:
	C:homepythondjango-trunkdjangocontrib
adminviewsdecorators.py in _checklogin, line 50
    Python Executable: 	c:binpython.exe
    Python Version: 	2.5.1
-------------
The online book has a note at this point that might be
interpreted to
mean all the default MIDDLEWARE_CLASSES should be
uncommented, after
which visiting http://127.0.0.1:8000/ad
min/ I get:

Traceback (most recent call last):

  File
"C:homepythondjango-trunkdjangocoreserversbaseht
tp.py",
line 277, in run
    self.result = application(self.environ,
self.start_response)
   .....
  File "C:homepythondjango-trunkdjangodbbackends
sqlite3base.py", line 133, in execute
    return Database.Cursor.execute(self, query, params)

OperationalError: no such table: django_session
--------------
Same results after uncommenting  'django.contrib.auth'
settings line.

I wasn't asked for a superuser and password with the syncdb
operation,
so after setting DJANGO_SETTINGS_MODULE and PYTHONPATH
variables I get
the following
> python
C:homepythonDjango-0.96.1djangocontribauthcreate_supe
ruser.py
Username: root
Traceback (most recent call last):
  File
"C:homepythonDjango-0.96.1djangocontribauth
create_superuser.py", l
ine 91, in <module>
    createsuperuser()
   ....
  File "C:homepythondjango-trunkdjangodbbackends
sqlite3base.py", line 13
3, in execute
    return Database.Cursor.execute(self, query, params)
sqlite3.OperationalError: no such table: auth_user


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


Re: admin interface startup problems
user name
2007-12-27 13:12:19
Not having the book yet (it's in the mail) I'm not sure
exactly what
is on page 84, so I'll make a couple of
suggestions/observations.

The "No such table" error message means exactly
what it says, so this
really feels like "python manage.py syncdb" wasn't
run (or wasn't run
successfully).

In addition to uncommenting the MIDDLEWARE lines you also
want to
uncomment the following INSTALLED_APPS lines:

INSTALLED_APPS = (
    'django.contrib.auth',       # This includes creating
the table
'auth_user'
    'django.contrib.contenttypes',
    'django.contrib.sessions',  # This creates the table
'django_sessions'
    'django.contrib.sites',
)

and *then* run syncdb again.

If you still don't get prompted for superuser it might mean
the Django
thinks that it has already created these tables (but the
error message
indicates it doesn't think so). Once Django sees that the
table
exists, it won't make any changes to it. This is called
schema
evolution (or migration) and it can be a tripping point.

So, you might want to reset the world by:

           python manage.py reset auth sessions --noinput  #
or
whatever apps you are doing the reset on

or, more brutally, just delete your sqlite3 file and do a
syncdb.
Either of these will destroy any data in the associated
tables, but
since you are working through a tutorial I'm assuming that
you don't
have too much invested in them.

  HTH,
  Peter


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


'WSGIRequest' object has no attribute 'user'
user name
2007-12-29 09:10:25
Thanks a lot, syncdb now works with the admin stuff, and
I entered the superuser account stuff when requested.

After that I restart the server and get AttributeError at
/admin/
'WSGIRequest' object has no attribute 'user', with traceback
at
http://dpaste.com/29308/. Don't see the admin login screen.

I'm using
urlpatterns = patterns(
    '',
    (r'^submit/', submit),
    (r'^time/$', current_datetime),
    (r'^admin/',
include('django.contrib.admin.urls')),
)

Any more thoughts much appreciated.

Chris

On Dec 27, 2:12 pm, hedronist <hedron...gmail.com> wrote:
> Not having the book yet (it's in the mail) I'm not sure
exactly what
> is on page 84, so I'll make a couple of
suggestions/observations.
>
> The "No such table" error message means
exactly what it says, so this
> really feels like "python manage.py syncdb"
wasn't run (or wasn't run
> successfully).
>
> In addition to uncommenting the MIDDLEWARE lines you
also want to
> uncomment the following INSTALLED_APPS lines:
>
> INSTALLED_APPS = (
>     'django.contrib.auth',       # This includes
creating the table
> 'auth_user'
>     'django.contrib.contenttypes',
>     'django.contrib.sessions',  # This creates the
table
> 'django_sessions'
>     'django.contrib.sites',
> )
>
> and *then* run syncdb again.
>
> If you still don't get prompted for superuser it might
mean the Django
> thinks that it has already created these tables (but
the error message
> indicates it doesn't think so). Once Django sees that
the table
> exists, it won't make any changes to it. This is called
schema
> evolution (or migration) and it can be a tripping
point.
>
> So, you might want to reset the world by:
>
>            python manage.py reset auth sessions
--noinput  # or
> whatever apps you are doing the reset on
>
> or, more brutally, just delete your sqlite3 file and do
a syncdb.
> Either of these will destroy any data in the associated
tables, but
> since you are working through a tutorial I'm assuming
that you don't
> have too much invested in them.
>
>   HTH,
>   Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: 'WSGIRequest' object has no attribute 'user'
user name
2007-12-29 10:03:25
Is there
'django.contrib.auth.middleware.AuthenticationMiddleware'
in
your MIDDLEWARE_CLASSES ?

On 29 ΔΕΛ, 18:10, Chris Haynes <chay...indiana.edu> wrote:
> Thanks a lot, syncdb now works with the admin stuff,
and
> I entered the superuser account stuff when requested.
>
> After that I restart the server and get AttributeError
at /admin/
> 'WSGIRequest' object has no attribute 'user', with
traceback athttp://dpaste.com/29308/. Don't see the admin login screen.
>
> I'm using
> urlpatterns = patterns(
>     '',
>     (r'^submit/', submit),
>     (r'^time/$', current_datetime),
>     (r'^admin/',
> include('django.contrib.admin.urls')),
> )
>
> Any more thoughts much appreciated.
>
> Chris
>
> On Dec 27, 2:12 pm, hedronist <hedron...gmail.com> wrote:
>
> > Not having the book yet (it's in the mail) I'm not
sure exactly what
> > is on page 84, so I'll make a couple of
suggestions/observations.
>
> > The "No such table" error message means
exactly what it says, so this
> > really feels like "python manage.py
syncdb" wasn't run (or wasn't run
> > successfully).
>
> > In addition to uncommenting the MIDDLEWARE lines
you also want to
> > uncomment the following INSTALLED_APPS lines:
>
> > INSTALLED_APPS = (
> >     'django.contrib.auth',       # This includes
creating the table
> > 'auth_user'
> >     'django.contrib.contenttypes',
> >     'django.contrib.sessions',  # This creates the
table
> > 'django_sessions'
> >     'django.contrib.sites',
> > )
>
> > and *then* run syncdb again.
>
> > If you still don't get prompted for superuser it
might mean the Django
> > thinks that it has already created these tables
(but the error message
> > indicates it doesn't think so). Once Django sees
that the table
> > exists, it won't make any changes to it. This is
called schema
> > evolution (or migration) and it can be a tripping
point.
>
> > So, you might want to reset the world by:
>
> >            python manage.py reset auth sessions
--noinput  # or
> > whatever apps you are doing the reset on
>
> > or, more brutally, just delete your sqlite3 file
and do a syncdb.
> > Either of these will destroy any data in the
associated tables, but
> > since you are working through a tutorial I'm
assuming that you don't
> > have too much invested in them.
>
> >   HTH,
> >   Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at htt
p://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: 'WSGIRequest' object has no attribute 'user'
user name
2007-12-29 13:49:39
> After that I restart the server and get AttributeError
at /admin/
> 'WSGIRequest' object has no attribute 'user', with
traceback athttp://dpaste.com/29308/. Don't see the admin login screen.


Huh. This smells vaguely like a problem we ran into when we
were
changing the way login authentication was being done. If it
is
related, you might have a cookie for a session (created
during your
earlier attempts) that somehow has wrong/missing info in it.
Try
flushing your browser's cookies and logging in again.

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


Re: 'WSGIRequest' object has no attribute 'user'
user name
2008-01-03 09:32:12
On Dec 29 2007, 11:03 am, Alex Koshelev <daeva...gmail.com> wrote:
> Is there
'django.contrib.auth.middleware.AuthenticationMiddleware'
in
> your MIDDLEWARE_CLASSES ?

No. Uncommenting
        'django.middleware.common.CommonMiddleware',
       
'django.contrib.sessions.middleware.SessionMiddleware',
       
'django.contrib.auth.middleware.AuthenticationMiddleware',
in the distribution settings file was progress, resulting in
a
complaint about no login.html file.
Copying django/controb/admin/templates/admin/ to templates
fixed that
and it works now.

The generally excellent book indicates only a few of the
changes
necessary to enable the admin system.

Thanks a lot for your help.

Chris

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


[1-6]

about | contact  Other archives ( Real Estate discussion Medical topics )