git &网页设计:处理多个自定义模板

发布于 2024-10-09 15:31:47 字数 501 浏览 2 评论 0原文

我正在开发一个 CMS(使用 Django,但这并不重要)并选择了 GIT。

安装将在以下方面有所不同:

  • 配置
  • 数据库内容
  • 媒体
  • 模板

前 3 个对于 git 来说不是问题:我们根本不需要这些:)

在开发时,我有 1 个带有相关媒体的默认模板。 之后,每个客户都会收到基于默认模板的自己的设计(一些轻微的定制)。

当我引入新功能时,我不会支持每个自定义模板。模块化对此有所帮助,但并不是 100% 的解决方案。

您有什么经验可以分享吗?


示例:目前,v0.1 非常出色:它有 1 个“默认”模板和 10 个自定义模板:每个客户一个。

现在,CMS v0.2 中出现了一些新功能:例如登录框。我在“默认”模板上测试了它,它工作得很好并且非常好。我为此感到自豪:) 现在,所有 10 位客户都希望拥有这个出色的创新登录框。我真的需要手动更新所有这 10 个自定义模板吗?

I'm developing a CMS (with Django, but that doesn't matter) and have chosen GIT.

Installations will vary in:

  • Configs
  • Database contents
  • Media
  • Templates

First 3 are not a problem with git: we simply don't need these :)

While developing, I have 1 default template with related media.
Later, each customer will receive his own design based on default templates (some slight customization).

I'm not going to support each of the custom templates as I introduce new features. Modularity helps with this but is not a 100% solution.

Do you have any experience to share?


Example: Currently, v0.1 rocks: it has one 'default' template and 10 customized: one per customer.

Now, in CMS v0.2 some new features has appeared: e.g. a login box. I tested it on the 'default' template, it works great & I'm proud of it :) Now, all 10 customers want to have that great innovative login-box. Do I really have to update all that 10 customized templates manually?

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

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

发布评论

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

评论(1

—━☆沉默づ 2024-10-16 15:31:47

在我看来,您基本上有两个选择:

  1. 告诉 git 忽略模板目录,并为每个新客户 git 克隆存储库,然后为每个客户创建单独的模板。 CMS 读入一组模板并呈现页面。
  2. 每个客户都有自己的模板子目录,您可以将模板放在其中。然后,您的 CMS 可以根据传入的 URL 或配置设置或其他内容加载相关模板。

现在,至于选择哪个,您需要考虑多个方面:

  • 您打算向您的客户提供 git 访问权限吗?
  • 您是否打算为所有客户提供一个应用程序实例(而不是为每个客户创建一个实例)?
  • 您是否要自己托管应用程序(而不是让客户托管自己的应用程序)?

如果任何一个问题的答案是肯定的,请使用第一个选项。您可能不希望客户看到/有权访问其他客户的模板。

如果答案是否定的,那么请检查您自己的工作流程并使用您认为最容易维护的工作流程。我可能选择第二个选项,因为您在更新应用程序时只需担心一个代码库,以及对模板进行版本控制的额外好处。

The way I see it, you essentially have two options:

  1. Tell git to ignore the templates directory, and git clone the repository for each new customer, and then create the individual templates for each of them. The CMS reads in the one set of templates and renders the page.
  2. Each customer gets their own templates subdirectory, and you put the templates in there. Then, your CMS can load the relevant templates depending on the incoming URL or a config setting, or something else.

Now, as for which to choose, there are multiple aspects of this that you need to consider:

  • Are you going to give git access to your customers?
  • Are you going to have one single instance of the application for all of your customers (and not create one instance for each of your customers)?
  • Are you going to host the application(s) yourself (and not let the customer host their own)?

If the answer is yes to any of the questions, use the first option. You probably don't want customers to see/have access to your other customers' templates.

If the answer is no to all of then, then examine your own workflow and use whichever you think is going to be easiest to maintain. I'd probably pick the second option, as you'd only have to worry about one codebase when updating your app, as well as the added benefit of having version control on the templates.

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