Pergunta

I'm getting the following error from userna: SiteProfileNotAvailable I know what the error means but the path in AUTH_PROFILE_MODULE is correct, so why I'm I getting this error?

Thanks

settings.py

# My apps
INSTALLED_APPS += (

    'project.apps.ranger',


)


#userna
ANONYMOUS_USER_ID = -1
AUTH_PROFILE_MODULE = 'project.apps.ranger.Profile'

model:

from django.db import models
from django.contrib.auth.models import User
from django.utils.translation import ugettext as _
from userena.models import UserenaLanguageBaseProfile


class Profile(UserenaLanguageBaseProfile):
    """
     Default profile of Ranger
    """
    GENDER_CHOICES = (
        (1, _('Male')),
        (2, _('Female')),
    )
    EYE_CHOICES = (
        (1, _('Blue')),
        (2, _('Green')),
        (3, _('Brown')),
    )

    gender = models.PositiveSmallIntegerField(_('gender'),
                                              choices=GENDER_CHOICES,
                                              blank=True,)


    user = models.OneToOneField(User,
                                unique=True,
                                verbose_name=_('user'),
                                related_name='user_profile')

Full Error:

SiteProfileNotAvailable at /

No exception supplied

Request Method:     GET
Request URL:    http://127.0.0.1:8000/
Django Version:     1.5.1
Exception Type:     SiteProfileNotAvailable
Exception Location:     /Users/user/Documents/workspace/project/django-env/lib/python2.7/site-packages/userena/utils.py in get_profile_model, line 119
Python Executable:  /Users/user/Documents/workspace/project/django-env/bin/python
Python Version:     2.7.2
Python Path:    

['/Users/user/Documents/workspace/project',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/site-packages/pip-1.2.1-py2.7.egg',
 '/Users/user/Documents/workspace/project/django-env/lib/python27.zip',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/plat-darwin',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/plat-mac',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/user/Documents/workspace/project/django-env/Extras/lib/python',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/lib-tk',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/lib-old',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/lib-dynload',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
 '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
 '/Users/user/Documents/workspace/project/django-env/lib/python2.7/site-packages']

File structure is like this:

project
   /project
      /apps
      /settings
   /logs
   /requirements
Foi útil?

Solução

I think your problem might be with how you're specifying the AUTH_PROFILE_MODULE setting. Try using ranger.profile instead of project.apps.ranger.profile.

See this blog post.

Outras dicas

Strangely, this error often seems to occur for me when I have a circular dependency. For example, when importing models from a django app into a models.py file which is itself imported into the first one. If you're running into this error, check that you are not doing a circular import.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top