Forums

Import AbstractUser Error

Hello,

i try out django since a few days and all runs fine. But now i have a error message when i try to import the subclass AbstractUser un my models.py like this:

from django.contrib.auth.models import AbstractUser

When i run the manager.py at the bach it returns an: ImportError: Canot import name AbstractUser.

Whats the matter with this? Im looking over the internet but cant find some solutions. Can anybody help.

Thanks Iron

I think that's a version clash problem. AbstractUser is a recent class in Django, and our system default for Python 2.7 is Django 1.3, which doesn't have it.

If you want to run a more recent Django version, you have two options:

Hi,

thanks for this hints. I have try out the virtualenv methode but it show me some error that i cant handle when i try to sync the databases. It says:

ImportError: No module named <mysite>.<myapp>

Where mysite and myapp are the names of my projekts

I also try the Python 3. In this case the syncdb command trows the error:

ImportError: No modul named <mysite>

I want to change a projekt that i have createt mith the pythonanywhere Web Tool to work with Django16. I have done all code changes such like exchange the execute command in the manage.py to work with django1.6 and so on.

What else can i do to make my projekt work.

Thanks for helping Iron

It's not really possible for me to tell the state of your code from your post. It sounds to me like you have bits and pieces of various different attempts all mixed together and interfering with each other. I would suggest starting from a known good state. Either start an entirely new Python 3 + Django 1.6 web app or create an entirely new Python 2.7 + virtualenv + Django 1.6 and make sure the result works. Then start moving the code from your existing project across checking that each piece leaves you with a working web app.

Ok, thanks for this answer. You are right i have make a terrible mix from python, python3 and different django versions. I thought so that this wont work.

Unfortunately with my basic version of pythonanywhere i can just start one web application but it will come out all right. I will experimenting with this options and looking forward to.