Migrating to a custom User model with South

30 views
Skip to first unread message

Guy Tamir

unread,
Sep 1, 2014, 3:17:25 AM9/1/14
to django...@googlegroups.com
Hey all,

I'm trying to create a custom User model on an existing project (Django 1.5.5).
I followed this tutorial, I created the new model, ran a "schemamigration"  once, which created the tables in the DB,
also ran the "Migrate" command once with the copying code in the "forward" method (like instructed in the tutorial in bullet no. 10.

The new custom model table was created and all the previous users were copied correctly.
Now, I'm trying to change the "AUTH_USER_MODEL" to newly created custom User model, but when I run the migrate command I'm getting
this error: 
ImproperlyConfigured: AUTH_USER_MODEL refers to model 'myappname.CustomUser' that has not been installed

I'm new to South, and this is my first time trying to work with the custom User option..
Not really sure how to fix this..

Some more details:
Django=1.5.5
South=1.0
Using Postgresql

Thanks,

Helton Alves

unread,
Sep 1, 2014, 6:50:20 AM9/1/14
to django...@googlegroups.com
do you put your "myappname" in INSTALLED_APPS on settings ?


--
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 django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
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/1c65a221-124a-4c24-ad96-1b7e7e44e3e8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Helton Alves 
Desenvolvedor web
Graduado em Sistemas de Informação - FACIMP
Cursando Metodologia do Ensino Superior - INESPO

Guy Tamir

unread,
Sep 1, 2014, 7:12:13 AM9/1/14
to django...@googlegroups.com
Yes its there.
Not sure if this can cause an issue but  "myappname" is the main app for my project where the settings.py file is at..
and the CustomUser is a model inside this app

Helton Alves

unread,
Sep 1, 2014, 7:51:18 AM9/1/14
to django...@googlegroups.com
your "myappname" is in the same directory?

ex:
settings.py
myappname/

or

settings.py
apps/
    myappname/

if in another directory, on INSTALLED_APPS have to are this mode "directory.myappname".



For more options, visit https://groups.google.com/d/optout.

Guy Tamir

unread,
Sep 1, 2014, 7:53:48 AM9/1/14
to django...@googlegroups.com
the layout is like this:

myappname (dir):
 - settings.py
 - models.py (here is the CustomUser model)

Helton Alves

unread,
Sep 1, 2014, 8:02:42 AM9/1/14
to django...@googlegroups.com
can you put here your full directory?



For more options, visit https://groups.google.com/d/optout.

Guy Tamir

unread,
Sep 1, 2014, 8:05:53 AM9/1/14
to django...@googlegroups.com
myappname(dir):
-settings.py
- admin.py
- forms.py
- models.py
- urls.py
- views.py
- wsgi.py

Helton Alves

unread,
Sep 1, 2014, 8:33:53 AM9/1/14
to django...@googlegroups.com
why don't you put your app in your own directory?
this mode is more organized.

project/
    settings.py
    views.py
    urls.py
    wsgi.py
    myappname/
        model.py
        forms.py
        views.py
        urls.py


For more options, visit https://groups.google.com/d/optout.

Guy Tamir

unread,
Sep 1, 2014, 10:51:19 AM9/1/14
to django...@googlegroups.com
I'll change it, thanks for the tip.
Found my problem though.

Inside the same models file where I created the CustomUser I also defined a "CaseInsensitiveModelBackend" that uses the get_user_model function
Since they were both in the same file it created a loop (i think) and when I moved it to another file it all worked fine.

Thanks
Reply all
Reply to author
Forward
0 new messages