简体   繁体   English

用Django实现配置应用的最佳方法是什么?

[英]What is the best approach to implement configuration app with Django?

I need to program kind of configuration registry for Django-based application. 我需要为基于Django的应用程序编程一种配置注册表。

Requirements: 要求:

  1. Most likely param_name : param_value structure 最有可能的param_nameparam_value结构
  2. Editable via admin interface 通过管理界面可编辑
  3. Has to work with syncdb. 必须使用syncdb。 How to deal with a situation in which other apps depend on configuration model and the model itself has not been initialized yet in DB? 如何处理其他应用程序依赖于配置模型并且模型本身尚未在DB中初始化的情况? Let's say I would like to have configurable model fields properties, ie the default value setting? 假设我想拥有可配置的模型字段属性,即默认值设置?

Any ideas or suggestions would be appreciated. 任何想法或建议,将不胜感激。

I have found djblets.siteconfig very useful. 我发现djblets.siteconfig非常有用。 Works great with the Admin app, and very easy to use. 与管理应用程序配合使用非常好,并且非常易于使用。 Highly recommended. 强烈推荐。

有一段时间(一年前),我使用dbsettings来通过管理界面访问某种业务配置,但是我不能说它今天如何适合。

I think you'll have trouble if you make other apps depend (at interpretation/app-loading time) on values set in your config app. 我认为,如果使其他应用程序(在解释/应用程序加载时)依赖于配置应用程序中设置的值,将会遇到麻烦。 Can you use some kind of placeholder value in Python code at interpretation time, and then pull in the real config data on the post_syncdb signal? 您可以在解释时在Python代码中使用某种占位符值,然后在post_syncdb信号上提取实际的配置数据吗?

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

相关问题 在现有 Django 应用程序中更改主键的最佳方法是什么? - What is the best approach to change primary keys in an existing Django app? 在django Web应用程序中实现“上次看到”功能的最佳方法是什么? - What is the best way to implement a 'last seen' function in a django web app? 实现 Django 3 Modal 表单的最佳方法是什么? - What is the best way to implement Django 3 Modal forms? 下一步取决于Django的最后一步的最佳方法是什么? - what is the best way to approach where next is depending on last step in django? 设计模型字段(如Django中的列表)的最佳方法是什么? - What is the best approach to design model fields that is like a list in Django? 在Django项目中使用Web套接字的最佳方法是什么? - What is the best approach to use Web Sockets with Django projects? 为现有应用定制 django 管理页面的最佳方法 - Best approach to customize django admin page for existing app Django静态文件的最佳配置 - Best configuration for Django staticfiles 将初始配置数据添加到 Python Django 实例的最佳做法是什么? - What are best practices for adding initial configuration data to a Python Django instance? Django Admin应用程序的最佳用途是什么? - What are the best uses for the Django Admin app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM