<i id='Lj75M'><tr id='Lj75M'><dt id='Lj75M'><q id='Lj75M'><span id='Lj75M'><b id='Lj75M'><form id='Lj75M'><ins id='Lj75M'></ins><ul id='Lj75M'></ul><sub id='Lj75M'></sub></form><legend id='Lj75M'></legend><bdo id='Lj75M'><pre id='Lj75M'><center id='Lj75M'></center></pre></bdo></b><th id='Lj75M'></th></span></q></dt></tr></i><div id='Lj75M'><tfoot id='Lj75M'></tfoot><dl id='Lj75M'><fieldset id='Lj75M'></fieldset></dl></div>

<small id='Lj75M'></small><noframes id='Lj75M'>

    • <bdo id='Lj75M'></bdo><ul id='Lj75M'></ul>
    <tfoot id='Lj75M'></tfoot>

      <legend id='Lj75M'><style id='Lj75M'><dir id='Lj75M'><q id='Lj75M'></q></dir></style></legend>

        管理站点:TemplateDoesNotExist at/admin/

        Admin Site: TemplateDoesNotExist at /admin/(管理站点:TemplateDoesNotExist at/admin/)

        <small id='J41hg'></small><noframes id='J41hg'>

            <tbody id='J41hg'></tbody>

            <legend id='J41hg'><style id='J41hg'><dir id='J41hg'><q id='J41hg'></q></dir></style></legend>

            <i id='J41hg'><tr id='J41hg'><dt id='J41hg'><q id='J41hg'><span id='J41hg'><b id='J41hg'><form id='J41hg'><ins id='J41hg'></ins><ul id='J41hg'></ul><sub id='J41hg'></sub></form><legend id='J41hg'></legend><bdo id='J41hg'><pre id='J41hg'><center id='J41hg'></center></pre></bdo></b><th id='J41hg'></th></span></q></dt></tr></i><div id='J41hg'><tfoot id='J41hg'></tfoot><dl id='J41hg'><fieldset id='J41hg'></fieldset></dl></div>
                  <bdo id='J41hg'></bdo><ul id='J41hg'></ul>

                • <tfoot id='J41hg'></tfoot>
                • 本文介绍了管理站点:TemplateDoesNotExist at/admin/的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在关注 Django 的官方 Tutorial 2 但由于某种原因无法创建管理站点,尽管按照我的理解正确执行所有步骤.

                  I'm following Django's official Tutorial 2 but for some reason cannot create an admin site despite following all the steps correctly to my understanding.

                  这是我得到的错误:

                  TemplateDoesNotExist at /admin/
                  admin/login.html
                  Request Method: GET
                  Request URL:    http://127.0.0.1:8000/admin/
                  Django Version: 1.3.1
                  Exception Type: TemplateDoesNotExist
                  Exception Value:    
                  admin/login.html
                  Exception Location: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/template/loader.py in find_template, line 138
                  Python Executable:  /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python
                  Python Version: 2.7.2
                  Python Path:    
                  ['/Users/jcugley/Documents/Programming/Python/Django/mysite',
                   '/Library/Python/2.7/site-packages/setuptools-0.6c11-py2.7.egg',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload',
                   '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages',
                   '/Library/Python/2.7/site-packages']
                  Server time:    Tue, 24 Jan 2012 18:40:03 -0600
                  

                  在我取消注释以下行(已注释)后发生错误:

                  The error occurs after I uncomment the following lines (commented):

                  ### urls.py ###
                  from django.conf.urls.defaults import patterns, include, url
                  
                  from django.contrib import admin # THIS LINE
                  admin.autodiscover() # THIS LINE
                  
                  urlpatterns = patterns('',
                      url(r'^admin/', include(admin.site.urls)), # THIS LINE
                  )
                  

                  如果我再次评论它们,它会消除错误.

                  If I comment them again it gets rid of the error.

                  确实在 settings.py 的 INSTALLED_APPS 中有 django.contrib.admin

                  I do have django.contrib.admin in my INSTALLED_APPS in settings.py

                  推荐答案

                  由于它可以在其他人的机器上运行,并且由于您启用了应用程序目录加载器,因此在 INSTALLED_APPS 中启用了管理站点,那就是发现模板所需的一切(我的意思是,还能做什么?)-我只能假设您的 django 安装有问题.

                  Since it works on other people's machines, and since you have the app directories loader enabled, admin site enabled in INSTALLED_APPS, and that's all it should take for templates to be discovered (I mean, what more can one do?) - I can only assume something is wrong with your django installation.

                  这将是开始使用 virtualenvs 和全新安装 django 以排除您的设置的好机会:

                  This would be a good chance to start using virtualenvs and a fresh install of django to rule out your settings:

                  启动终端,导航到您的项目目录(实际上并不重要...)

                  Fire up a terminal, navigate to your project directory (doesn't actually matter...)

                  pip install virtualenv # if you don't have it.
                  
                  virtualenv --no-site-packages env 
                  # this creates a virtual python environment that doesn't include system packages
                  
                  source env/bin/activate
                  # this forces your bash session to use that environment
                  
                  pip install django
                  # installs a fresh copy of django to your new environment
                  
                  cd path_to_my_django_project    
                  # now go to your site directory
                  
                  python manager.py runserver
                  # visit admin site.
                  

                  这篇关于管理站点:TemplateDoesNotExist at/admin/的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  What happens when you compare 2 pandas Series(当你比较 2 个 pandas 系列时会发生什么)
                  Quickly find differences between two large text files(快速查找两个大文本文件之间的差异)
                  Python - Compare 2 files and output differences(Python - 比较 2 个文件和输出差异)
                  Why do comparisions between very large float values fail in python?(为什么在 python 中非常大的浮点值之间的比较会失败?)
                  Dictionary merge by updating but not overwriting if value exists(字典通过更新合并,但如果值存在则不覆盖)
                  Find entries of one text file in another file in python(在python中的另一个文件中查找一个文本文件的条目)
                    <bdo id='hkrVq'></bdo><ul id='hkrVq'></ul>

                    <legend id='hkrVq'><style id='hkrVq'><dir id='hkrVq'><q id='hkrVq'></q></dir></style></legend>

                    <i id='hkrVq'><tr id='hkrVq'><dt id='hkrVq'><q id='hkrVq'><span id='hkrVq'><b id='hkrVq'><form id='hkrVq'><ins id='hkrVq'></ins><ul id='hkrVq'></ul><sub id='hkrVq'></sub></form><legend id='hkrVq'></legend><bdo id='hkrVq'><pre id='hkrVq'><center id='hkrVq'></center></pre></bdo></b><th id='hkrVq'></th></span></q></dt></tr></i><div id='hkrVq'><tfoot id='hkrVq'></tfoot><dl id='hkrVq'><fieldset id='hkrVq'></fieldset></dl></div>
                        <tbody id='hkrVq'></tbody>

                          <small id='hkrVq'></small><noframes id='hkrVq'>

                            <tfoot id='hkrVq'></tfoot>