So I figured out a hack to solve this problem and hopefully this will save
someone from this problem in the future.

After RemoteUserMiddleware is included in the settings.py file, when you
visit any area of the site where your server asks you to log in, once you
log in it will automatically create an entry for your username in the
database table auth_user. This row with your server's username is created
the first time you do this.

Now the problem is, when you go to the admin site, you are technically
already logged in to your server, but you see the dialog box asking for
username and password. You might think to yourself, "I should just be able
to enter a superuser's credentials and log in", but this will not work. And
if you think about it, it's kind of weird. Your already logged in to your
server via your username, which your django app is now using, and then
trying to enter someone else's credentials (i.e. the superuser). So its like
your trying to log in on top of your servers username with the superuser.
Kind of weird.

So what can you do?

If you look at the entry in the database that was generated when you first
logged in to your django app using your server's username, the values
'is_staff' and 'is_superuser' are set to '0'. All you need to do is manually
set 'is_superuser' for that entry. Then when you go to the admin site, it
will automatically authenticate you, no need to provide credentials again.

So for mysql you would need to run the following command (substitute '
usern...@your-server.com' with the username you use for your server):

*UPDATE auth_user SET is_superuser='1' where username = '
usern...@your-server.com';*

I hope this helps anyone that has the same issue. Feel free to contact me
with any questions at dtdan...@indiana.edu

Cheers!
Dustin


On Sat, Apr 30, 2011 at 9:40 PM, Dustin <dustin...@gmail.com> wrote:

> Hello,
>
> I'm having difficulty finding a fix for this problem. Someone posted
> the exact same problem I am having about a year ago. Has there been
> any solution to this?
>
> Basically, RemoteUserMiddleware is working just fine after I followed
> these directions:
> http://docs.djangoproject.com/en/dev/howto/auth-remote-user/#configuration
>
> My problem is that I can not seem to log into the admin site with any
> users, even superusers created via manage.py
>
> Here is a link to the old article:
>
> http://groups.google.com/group/django-users/browse_thread/thread/0fe27b2ca4056c8a/7a12438967014133?show_docid=7a12438967014133
>
> Any help will be extremely appreciated :)
>
> Thank you,
> Dustin

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

Reply via email to