简体   繁体   English

从 Zend Framework 开发人员的角度来看 Django

[英]Django from the point of view of Zend Framework developer

I mostly work in ZF.我主要在采埃孚工作。 However, for next project I want to try Django.但是,对于下一个项目,我想尝试 Django。 Does anyone have experience of moving from ZF to Django?有没有人有从 ZF 迁移到 Django 的经验?

What are the most striking differences or difficulties in the switch from ZF to Django (except programming language)?从 ZF 切换到 Django(编程语言除外)最显着的区别或困难是什么? Was it easy to change or not?是否容易改变?

I'm currently porting an application written in ZF to Django .我目前正在将用 ZF 编写的应用程序移植到Django In my experience the main difference between the two frameworks is the coupling between their internal components.以我的经验,这两个框架之间的主要区别在于它们内部组件之间的耦合。 ZF takes it's concept of loose coupling to the extreme where you have to figure out the best way to fit them together. ZF 将松散耦合的概念发挥到了极致,您必须找出将它们组合在一起的最佳方式。 Django on the other hand provides a seamless process of developing a web application where each of its components fit together in a defined order.另一方面,Django 提供了开发 web 应用程序的无缝流程,其中每个组件以定义的顺序组合在一起。 For example when you define a model in Django ORM it provides so much functionality to the other components of the framework such as views, templates, forms etc., that it's hard to imagine using them without the models. For example when you define a model in Django ORM it provides so much functionality to the other components of the framework such as views, templates, forms etc., that it's hard to imagine using them without the models. In some sense tight coupling is one of Djangos strengths in making web development less cumbersome and more efficient.从某种意义上说,紧密耦合是 Django 的优势之一,它使 web 开发变得更简单、更高效。 But this sometimes makes Django less flexible.但这有时会使 Django 不够灵活。

Also after using ZFs db abstraction layer (Which for some queries produces very unmaintainable code) you'll find Djangos ORM a heaven sent:).同样在使用ZFs db 抽象层(对于某些查询会产生非常难以维护的代码)之后,您会发现 Djangos ORM 是天堂派来的:)。 Although some ORM solutions exist for PHP(or ZF), Djangos ORM is way better.虽然一些 ORM 解决方案适用于 PHP(或 ZF),但 Django 的 ORM 更好。

Another big difference is Djangos URL confs , which makes it extremely easy and flexible to provide cruft free, user friendly(SE friendly) URLs.另一个很大的不同是 Django 的URL confs ,这使得提供免费、用户友好(SE 友好)的 URL 变得非常容易和灵活。 With Django, URLs are an integral part of the application not some http sever configuration you get stuck with.使用 Django,URL 是应用程序不可分割的一部分,而不是您遇到的某些 http 服务器配置。

Another very important part of the comparison is the documentation.比较的另一个非常重要的部分是文档。 Djangos documentation is extremely well written and maintained. Django 的文档编写和维护得非常好。 All though ZFs documentation is good enough, I found it very hard to search through for something.尽管 ZFs 文档已经足够好,但我发现很难搜索到一些东西。

I think you've taken a good decision to tryout Django.我认为您已经做出了一个很好的决定来试用 Django。 Hope it turns out to be the right solution for you.希望它证明是适合您的解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM