Django - 网站首页 [英] Django - Website Home Page
问题描述
但是我喜欢做的一件事是安排索引访问重定向到另一个地方。但是,如果你喜欢,可以给出索引页面一个简单的视图。
也就是说,将所有代码保存在实际的应用程序中可能是一个好主意,以便您可以更轻松地重构它,并使其出现在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屋!