我刚刚玩过django-satchmo电子商店应用程序。 Satchmo使用satchmo-livesettings或只是生活设置来实现这个目标。除此之外,还可以使用管理界面更改设置。
唯一的问题是我没有找到关于如何使用生命设置的教程。但是如果你浏览satchmo代码,你会看到它是如何工作的。
这里是我的榜样
from livesettings import config_register, StringValue, PositiveIntegerValue
SHOP_GROUP = ConfigurationGroup('SHOP', ('ShirtSale Shop Settings'), ordering=0)
CHARGE_PORTO = config_register(
BooleanValue(SHOP_GROUP,
'CHARGE_PORTO',
description = ('Porto Erheben?'),
help_text = ("Wird bei Bestellungen zusaetzlich ein Porto erhoben?"),
default = True))
我已经包括在config.py文件的那些行。为了执行这个文件是必要的:在admin.py文件
import config
(我不知道这是否是必要的)
为了进入设置我已经包括以下的urls.py文件:
(r'^settings/', include('livesettings.urls')),
可能相关吗? http://www.chicagodjango.com/blog/django-settings-database/ – Amber 2011-01-11 07:12:25