Django filebrowser异常。我不明白怎么了

2024-09-30 14:20:16 发布

您现在位置:Python中文网/ 问答频道 /正文

我在努力让它成功。我有很多错误,但这一个是最奇怪的。请帮我弄清楚这里怎么了。 以下是日志:

KeyError at /
'filebrowser'
Request Method: GET
Django Version: 1.4
Exception Type: KeyError
Exception Value:    'filebrowser'
Exception Location: /home/vhosts/malinnikov.tomsk.ru/private/new_malinnikov/filebrowser/sites.py in get_default_site, line 88
Python Executable:  /opt/python27/django/1.4/bin/python
Python Version: 2.7.0

模板呈现过程中出错: 在模板/主页/vhosts中/malinnikov.tomsk.ru/httpdocs/templates/index.html,第69行出错

^{pr2}$

这是filebrowser的函数代码/网站.py异常所在的位置。在

78. def get_default_site(app_name='filebrowser'):
79. """
80. Returns the default site. This function uses Django's url resolution method to
81    obtain the name of the default site.
82.  """
83. # Get the name of the default site:
84. resolver = get_resolver(get_urlconf())
85. name = 'filebrowser'
86.
87. # Django's default name resolution method (see django.core.urlresolvers.reverse())
88. app_list = resolver.app_dict[app_name]
89. if not name in app_list:
90.   name = app_list[0]
91.    
92. return get_site_dict()[name]

我忘记了,当我尝试在控制台中运行时发生此错误:

manage.py loaddata ~/httpdocs/data-backup.json

当DB为空时不会发生此错误。在


Tags: thedjangonamepyappdefaultget错误