Reputation: 5993
I am trying to make a user profile object; my models.py presently reads:
from django.contrib.auth.models import User
from django.db.models.signals import post_save
from django.db import models
class UserProfile(models.Model):
name = models.TextField()
scratchpad = models.TextField()
user = models.ForeignKey(User, unique = True)
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user = instance)
post_save.connect(create_user_profile, sender = User)
In my settings.py I have at the top:
AUTH_PROFILE_MODULE = 'models.UserProfile'
I am getting an error screen:
SiteProfileNotAvailable at /
Unable to load the profile model, check AUTH_PROFILE_MODULE in your project settings
Request Method: GET
Request URL: http://localhost:8000/
Django Version: 1.3.1
Exception Type: SiteProfileNotAvailable
Exception Value:
Unable to load the profile model, check AUTH_PROFILE_MODULE in your project settings
Exception Location: /usr/local/Cellar/python/2.7/lib/python2.7/site-packages/django/contrib/auth/models.py in get_profile, line 380
Python Executable: /usr/local/bin/python
Python Version: 2.7.0
Python Path:
['/Users/jonathan/pim',
'/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/distribute-0.6.14-py2.7.egg',
'/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/pip-0.8.1-py2.7.egg',
'/usr/local/Cellar/python/2.7/lib/python27.zip',
'/usr/local/Cellar/python/2.7/lib/python2.7',
'/usr/local/Cellar/python/2.7/lib/python2.7/plat-darwin',
'/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac',
'/usr/local/Cellar/python/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
'/usr/local/Cellar/python/2.7/lib/python2.7/lib-tk',
'/usr/local/Cellar/python/2.7/lib/python2.7/lib-old',
'/usr/local/Cellar/python/2.7/lib/python2.7/lib-dynload',
'/usr/local/Cellar/python/2.7/lib/python2.7/site-packages',
'/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/PIL',
'/usr/local/lib/python2.7/site-packages',
'/usr/local/Cellar/python/2.7/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info']
Server time: Tue, 14 Feb 2012 11:48:23 -0600
The models.py file is in /Users/jonathan/pim.
What am I doing wrong here? How can I set things so that the UserProfile in models.py registers as a user profile?
Thanks,
--EDIT--
Regarding the site and package names, I have the UserProfile defined in models.py in the root of the project, /Users/jonathan/pim. Does this need to be moved to an application within the project? At present I do not have applications sliced off.
--SECOND EDIT--
A tarball is at http://JonathansCorner.com/project/pim.tgz
Upvotes: 0
Views: 692
Reputation: 28637
i think you need
AUTH_PROFILE_MODULE = 'app.UserProfile'
(note app.Model
, not models.UserProfile
)
where app
is the name of your app
Upvotes: 2