[英]Should I use Django's contrib applications or build my own?
The Django apps come with their own features and design. Django应用程序具有自己的功能和设计。 If your requirements don't match 100% with the features of the contib app, you end up customizing and tweaking the app.
如果您的要求与contib应用程序的功能不完全匹配,则最终会自定义和调整应用程序。 I feel this involves more effort than just building your own app to fit your requirements.
我觉得这比仅仅构建自己的应用程序以满足您的需求需要更多的努力。
What do you think? 你怎么看?
It all depends. 这完全取决于。 We had a need for something that was 98% similar to contrib.flatpages.
我们需要与contrib.flatpages有98%相似的东西。 We could have monkeypatched it, but we decided that the code was so straightforward that we would just copy and fork it.
我们可以对它进行monkeypatched,但我们认为代码非常简单,我们只需要复制并分叉它。 It worked out fine.
结果很好。
Doing this with contrib.auth, on the other hand, might be a bad move given its interaction with contrib.admin & contrib.session. 另一方面,使用contrib.auth执行此操作可能是一个糟糕的举动,因为它与contrib.admin和contrib.session的交互。
I'd also check out third-party re-usable apps before building my own. 在构建自己的应用程序之前,我还会查看第三方可重用的应用程序。 Many are listed on Django Plug(g)ables , and most are hosted on Google Code , GitHub or BitBucket .
许多都列在Django Plug(g)ables上 ,大多数都托管在Google Code , GitHub或BitBucket上 。
Most of the apps in django.contrib are written very well and are highly extensible. django.contrib中的大多数应用程序编写得非常好,并且具有高度可扩展性。
Don't like quite how comments works? 不喜欢评论如何运作? Subclass the models and forms within it, adding your own functionality and you have a working comment system that fits your sites schema, with little effort.
在其中对模型和表单进行子类化,添加自己的功能,并且您可以轻松地使用适合您的站点架构的工作注释系统。
I think the best part when you extend the contrib apps is you're not really doing anything hacky, you're just writing (mostly) regular Python code to add the functionality. 我认为扩展contrib应用程序时最好的部分是你并没有真正做任何hacky,你只是编写(主要是)常规Python代码来添加功能。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.