Django - 网站首页 [英] Django - Website Home Page

查看:103
本文介绍了Django - 网站首页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在看Django,从我看到的,这真是太棒了。我有点困惑,但是,我如何为我的网站实施主页?这是一个单独的应用程序,还是只是项目中的一个视图,还是什么?

解决方案

但是我喜欢做的一件事是安排索引访问重定向到另一个地方。但是,如果你喜欢,可以给出索引页面一个简单的视图。



也就是说,将所有代码保存在实际的应用程序中可能是一个好主意,以便您可以更轻松地重构它,并使其出现在python路径作为普通模块。在项目中,而不是一个应用程序的意见似乎会导致更多的头痛比解决。


I've been having a look at Django and, from what I've seen, it's pretty darn fantastic. I'm a little confused, however, how I go about implementing a "home page" for my website? Would it be a separate app, or just a view within the project, or what?

解决方案

There's no real rule for this, But one thing I like to do is actually arrange for the index access to redirect to another spot. If you prefer, though, you can just give the index page a plain view.

That said, It's probably a good idea to keep all your code in an actual app, so that you can refactor it more easily, and so that it appears on the python path as a normal module. Putting views in the project rather than an app seems to cause more headaches than it solves.

这篇关于Django - 网站首页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆