Django 可重用应用程序

发布于 2024-08-06 15:20:49 字数 519 浏览 1 评论 0原文

我遇到了许多关于 Django 项目和可重用应用程序之间差异的资源,最突出的是 DjangoCon 谈话Pinax 项目

然而,作为一个新手,编写自己的项目和可重用的软件似乎有点具有挑战性。我不太明白模型如何去哪里(以及应用程序如何变得灵活和宽容)、模板去哪里以及不同的应用程序如何融合在一起。

是否有关于使用可重用应用程序创建项目的教程?良好实践页面?最理想的是,一个具有自己的应用程序的示例项目(而不是依赖于外部应用程序)?

我的目标是了解项目的架构以及应用程序之间的交互,而不仅仅是构建可重用的应用程序。我在网上遇到的大多数教程都是关于构建可重用的应用程序,或构建一个简单的单一博客应用程序,该应用程序仅对内置或 django.contrib 模块具有外部依赖关系。

I came across many resources about the difference between Django projects and reusable apps, most prominently the DjangoCon talk, and Pinax Project.

However, being a newbie, writing my own projects and reusable software seems to a bit challenging. I don't quite understand how where models go (and how apps can be flexible and permissive), where the templates go, and how the different apps mesh together.

Are there any tutorials on creating a project with reusable apps? Good practices page? Most preferably, a sample project with its own apps (rather than depend on external apps)?

I am aiming to understand the architecture of a project and interaction between apps rather than just building reusable apps. Most tutorials I came across online are about building a reusable app, or building a simple monothelic blog app that only has external dependencies on builtin or django.contrib modules.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

流绪微梦 2024-08-13 15:20:49

James Bennett 的 实用 Django 项目 很好地涵盖了这些主题甚至包括专门关于“编写可重用 Django 应用程序”的一章,其中介绍了将书中的示例项目之一拆分为自己的应用程序的示例。

James Bennett's Practical Django Projects does a pretty good job of covering those topics in general and even includes a chapter specifically on "Writing Reusable Django Applications" that goes through an example of splitting one of the example projects in the book out into its own app.

琉璃繁缕 2024-08-13 15:20:49

您可以观看视频 (DjangoCon 2008:可重用应用程序) - http://www.youtube。 com/watch?v=A-S0tqpPga4 并了解如何使用它。

Google、djangosnippets、git 等有很多可重用的应用程序。最流行的是:

  • django-contact-form - 反馈表;
  • django-debug-toolbar - 观看 sql 查询等;
  • django-registration + django-profiles - 跳过注册例程;
  • django-mptt - 使用树结构;
  • django-pagination - 有用的每页查看器;
  • django-stdimage 或 sorl-thumbnail - 图像例程;
  • 南 - 模式迁移;

阅读示例文档并节省您的开发时间。祝你好运!

You can watch video (DjangoCon 2008: Reusable Apps) - http://www.youtube.com/watch?v=A-S0tqpPga4 and get the idea, how to use it.

There are a lot of reusapbe apps at Google, djangosnippets, git, etc. Most popular:

  • django-contact-form - feedback form;
  • django-debug-toolbar - watch sql queries and etc;
  • django-registration + django-profiles - skip regs routines;
  • django-mptt - use tree structure;
  • django-pagination - usefull per-page viewer;
  • django-stdimage or sorl-thumbnail - image routines;
  • south - schema migrations;

Read samples docs and save your dev-time. Good luck!

如痴如狂 2024-08-13 15:20:49

如果您想查看“可重用应用程序相互交互的示例项目”,没有比下载 Pinax 更好的地方了,克隆他们的示例项目之一(只需遵循文档)并仔细阅读代码。

If you want to see "sample projects with reusable apps interacting with each other," there's no better place to go than downloading Pinax, cloning one of their sample projects (just follow the docs) and reading through the code carefully.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文