我用django 1.9.7安装了django-userena, https://github.com/bread-and-pepper/django-userena 一步一步,为什么我收到这个错误?
由于 settings.py
INSTALLED_APPS = [
'userena',
'guardian',
'easy_thumbnails',
]
ANONYMOUS_USER_ID = -1
错误:
Traceback (most recent call last):
File "manage.py", line 12, in <module>
execute_from_command_line(sys.argv)
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 353, in execute_from_command_line
utility.execute()
File "C:\Python27\lib\site-packages\django\core\management\__init__.py", line 327, in execute
django.setup()
File "C:\Python27\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python27\lib\site-packages\django\apps\registry.py", line 115, in populate
app_config.ready()
File "C:\Python27\lib\site-packages\django\contrib\admin\apps.py", line 22, in ready
self.module.autodiscover()
File "C:\Python27\lib\site-packages\django\contrib\admin\__init__.py", line 26, in autodiscover
autodiscover_modules('admin', register_to=site)
File "C:\Python27\lib\site-packages\django\utils\module_loading.py", line 50, in autodiscover_modules
import_module('%s.%s' % (app_config.name, module_to_search))
File "C:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Python27\lib\site-packages\userena\admin.py", line 31, in <module>
admin.site.register(get_profile_model(), GuardedModelAdmin)
File "C:\Python27\lib\site-packages\userena\utils.py", line 137, in get_profile_model
raise SiteProfileNotAvailable
userena.compat.SiteProfileNotAvailable
答案 0 :(得分:0)
如docs中所述,您需要从管理面板或shell或通过fixture创建一个Site对象(请参阅Sites Framework),并使用function LetterCapitalize(str) {
var split = str.split('');
for (var i in split) {
if (i === 0) {
split[i] = split[i].toUpperCase();
} else if (split[i] === " ") {
split[i+1] = split[i+1].toUpperCase();
}
}
str = split.join('');
return str;
}
console.log(LetterCapitalize('hello world'));
在设置中定义其ID。 / p>