本文介绍了Django的Apache的 - 管理页面的链接可见,但不能点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚部署了Django的网站,并在改变值我DEBUG变量为假导致我的管理页面链接从活动链接简单的文本改变。

I have just deployed a django site, and upon changing the value my DEBUG variable to 'False' causes my admin page links to change from active links to simple text.

这是试图直接进入我所知道的的是URL导致TemplateDoesNotExist。

An attempt to go directly to what I know should be the URL causes a 'TemplateDoesNotExist'.

我相信这不是一个权限问题与Apache,我觉得这是值得做我的管理配置,虽然我不知道。

I am sure it's not a permissions issue with Apache, I feel it is something to do with my admin configuration though I have no idea what.

推荐答案

我想通了。这里是别人的参考谁可能会发现自己这个问题。

I figured it out. Here is a reference for anyone else who might find themselves with this problem.

我使用的是什么必须定义自己的管理模式的去precated方法 - 我把他们都在的 models.py 的,而不是创建一个单独的 admin.py 的文件为每个应用程序。

I was using what must be a deprecated method of defining my Admin models - I put them all in models.py, instead of creating a separate admin.py file for each application.

在学习Django的,有大量的建议或提供使用该方法的实例教程左右浮动的。显然,这已经不再是一个不错的主意(至少不是Django的1.4)。这也许可以争吵与一些模板黑客的工作,但它可能是更清洁,绝对简单只需按照最新的公约和创造的 admin.py 的文件。

When learning django, there are plenty of tutorials floating around that recommend or give examples that use this method. Apparently this is no longer a good idea (at least not as of Django 1.4). It could probably be wrangled into working with some template hacking, but it is is probably cleaner and definitely simpler to just follow the latest conventions and create the admin.py file.

我想我只需恶补这一切到一个文件中节省时间现在,但如果没有某种神奇的唯一调试模板加载,该解决方案失败。

I thought I was saving time by just cramming it all into one file "for now" but without some of the magical debug-only template loading, this solution failed.

希望这可以节省一些人无奈!

Hope this saves someone some frustration!

这篇关于Django的Apache的 - 管理页面的链接可见,但不能点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 00:43