1个django应用程序中约20个模型 [英] About 20 models in 1 django app

查看:144
本文介绍了1个django应用程序中约20个模型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经开始在自己的本地应用程序上运行浏览器。最近经历了django教程,我认为使用django而不是简单的python可能会更好。

I have started work on a local app for myself that runs through the browser. Having recently gone through the django tutorial I'm thinking that it might be better to use django rather than just plain python.

有一个问题:我至少有20个模型每个都有很多功能。很简单,它将创建一个巨大的模型文件,也可能是巨大的意见。如何拆分?

There's one problem: I have at least 20 models and each will have many functions. Quite simply it's going to create one huge models file and probably huge views too. How do I split them up?

模型都是相关的,所以我不能简单地将它们分成单独的应用程序我可以吗?

The models are all related so I can't simply make them into separate apps can I?

推荐答案

我有至少20个模型 - 这可能是一个以上的Django应用程序,更像一个Django项目与几个小的应用程序

"I have at least 20 models" -- this is probably more than one Django "app" and is more like a Django "project" with several small "apps"

我喜欢围绕具有少数(1到5)型号的主题或主题区域进行分割。这成为一个Django应用程序,是可重用性的有用单位。

I like to partition things around topics or subject areas that have a few (1 to 5) models. This becomes a Django "app" -- and is the useful unit of reusability.

整个项目是一个集合的应用程序,

The overall "project" is a collection of apps that presents the integrated thing built up of separate pieces.

这也有助于项目管理,因为每个应用程序都可以成为一个发行版的冲刺。

This also helps for project management since each "app" can become a sprint with a release at th end.

这篇关于1个django应用程序中约20个模型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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