2012-02-14 6 views
0

私はユーザープロファイルオブジェクトを作成しようとしています。私のmodels.pyは現在、読み取ります。私のsettings.pyでDjangoのユーザプロファイルを使用しようとしたのはなぜですか?

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) 

私が一番上に持っている:

AUTH_PROFILE_MODULE = 'models.UserProfile' 

私はエラー画面取得しています:

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 

models.pyをファイルは/ Users/jonathan/pimにあります。

私はここで間違っていますか? models.pyのUserProfileがユーザープロファイルとして登録されるように設定するにはどうすればよいですか?サイトとパッケージ名について

おかげで、

--EDIT--

は、私はプロジェクト、/ユーザ/ジョナサン/ PIMのルートでmodels.pyで定義されているのUserProfileを持っています。これをプロジェクト内のアプリケーションに移動する必要がありますか?現在、私はアプリケーションをスライスしていません。

- 第2 EDIT--

tarボールは、私はあなたがapp名前です

AUTH_PROFILE_MODULE = 'app.UserProfile' 

(ノートapp.Model、ないmodels.UserProfile

が必要だと思うhttp://JonathansCorner.com/project/pim.tgz

+0

"user = models.OneToOneField(User)"を設定しても同じように動作します。 – JonathanHayward

答えて

2

でありますあなたのアプリの

+0

私は 'pim.UserProfile'に設定すると、同じようなエラーが表示されます。 – JonathanHayward

+0

@ JonathanHayward:あなたのサイト/アプリケーションツリーのパッケージ名はどれくらい**なのですか? ** **質問を更新してください。 –

0

外観からは、pimはINSTALLED_APPS設定にはありません

関連する問題