Because of the code:

from django.contrib.auth.models import User

class UserProfile(models.Model):
    # project userprofile, also set as AUTH_PROFILE_MODULE
    user = models.ForeignKey(User, unique=True)

class AppUserProfile(UserProfile):
    # some app specific extension

and also the test:

user = User.objects.create()
profile = UserProfile.objects.get_or_create(user=user)

it fails around the last line, saying:

IntegrityError: column user_id is not unique

Things I suspect is the fact that Django uses exactly the same table for user-userprofile and user-anotheruserprofile relationship based on ForeignKey.

How do i solve this issue?

The reason for the mistake is always that you're creating two UserProfile-s with similar user_id. You're using "multi-table inheritance", which means you just call AppUserProfile.objects.get_or_create(user=user) and it'll act as expected.

Documentation for Django Models describes it very good.