TemplateDoesNotExist at /admin/portfolio/collection/add/ adm



我安装了应用程序django-portfolio,可以使用runserver ok。当我转到管理页面向Collections模型添加新对象时,得到以下错误页面:

TemplateDoesNotExist at /admin/portfolio/collection/add/
adminsortable/edit_inline/stacked.html
Request Method: GET
Request URL:    http://127.0.0.1:8000/admin/portfolio/collection/add/
Django Version: 1.8.3
Exception Type: TemplateDoesNotExist
Exception Value:    
adminsortable/edit_inline/stacked.html
Exception Location: C:Python27libsite-packagesdjangotemplateengine.py in find_template, line 146
Python Executable:  C:Python27python.exe
Python Version: 2.7.5
Python Path:    
['C:\depot',
 'C:\Users\user\AppData\Roaming\Python\Python27\site-packages\setuptools-5.4.1-py2.7.egg',
 'C:\WINDOWS\SYSTEM32\python27.zip',
 'C:\Python27\DLLs',
 'C:\Python27\lib',
 'C:\Python27\lib\plat-win',
 'C:\Python27\lib\lib-tk',
 'C:\Python27',
 'C:\Users\user\AppData\Roaming\Python\Python27\site-packages',
 'C:\Python27\lib\site-packages']
Server time:    Fri, 14 Aug 2015 17:12:32 +0800
Template-loader postmortem
Django tried loading these templates, in this order: Using loader
django.template.loaders.filesystem.Loader: Using loader
django.template.loaders.app_directories.Loader:
C:Python27libsite-packagesdjangocontribadmintemplatesadminsortableedit_inlinestacked.html
(File does not exist)
C:Python27libsite-packagesdjangocontribauthtemplatesadminsortableedit_inlinestacked.html
(File does not exist)
C:depotdepotapptemplatesadminsortableedit_inlinestacked.html
(File does not exist)
C:depotportfoliotemplatesadminsortableedit_inlinestacked.html
(File does not exist)

我认为你还没有在app目录下的admin.py文件中注册你的应用程序。

在应用程序目录(而不是项目)的admin.py中执行此操作:

from django.contrib import admin
from app.models import MyModel
admin.site.register(MyModel)

考虑到你的应用程序名称是app,你的模型名称是MyModel

对应用中的所有模型都这样做。

相关内容

  • 没有找到相关文章

最新更新