On Fri, Dec 20, 2013 at 12:08 PM, <[email protected]> wrote: > I'm creating a custom user by extending the AbstractBaseUser class. I have > read the Django documentation and several tutorials online and I think that > what I've done till now is very basic and should work. > > The problem I'm facing is that even if I create a new DB from scratch and > do a syncdb, the manage.py console **does not ask me for a admin username > and password** (as it usually does). Hence, I cannot access /admin. > > The problem is partially (and wrongly) resolved my using > AUTH_PROFILE_MODULE instead of AUTH_USER_MODEL. This however leads to > 'Users' and 'MyUser' being showed as different objects on the admin page > i.e. MyUser is not set as the default user. (obviously) >
This sounds like there's some sort of import problem happening. First off - if syncdb doesn't ask you for an admin password, you can do the same thing manually - syncdb is just doing an implicit call to ./manage.py createsuperuser, so if you invoke that, you can create a user account. The implicit call to createsuperuser happens because syncdb sends out a signal, and contrib.auth hooks onto that signal. If this isn't happening, it means that contrib.auth isn't being installed correctly. It's difficult to diagnose exactly what's happening without having all the code in front of me, but some possible candidates are: * An import error on one of your modules (e.g., Profiles) that is being swallowed * Multiple settings.py files on your PYTHONPATH, so the settings file you *think* is being used isn't actually the right one. The capitalisation of the Profiles module name might also be causing problems; Python convention is generally that module names are lower case (yes, there are exceptions, but it's a generally true). it's possible you're getting tripped up by some internals in the app cache that are altering the capitalisation of the module, which in turn cause problems when you reference the capitalised module name. If you try to run createsuperuser and it raises an error (or creates the wrong model), that might also help point at the problem. Sorry I can't point you at a single obvious solution, but hopefully I've given you enough to get over this hump. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJxq84-OqYnW-8Zv9VFPQeqx%3DowCPhJuB%2BG-tK2OfCLV774yGg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.

