@define_check
def check_deprecated_settings(output):
with output.section("Deprecated settings") as section:
found = False
for deprecated in ['CMS_FLAT_URLS', 'CMS_MODERATOR']:
if hasattr(settings, deprecated):
section.warn("Deprecated setting %s found. This setting is no longer in use and can be removed" % deprecated)
found = True
if not found:
section.skip("No deprecated settings found")
抱歉,我还不能评论。在
如果您不想有任何花哨的东西,您可以简单地比较Python版本并发出警告。在
或者你可以做最好的方法:去一个受欢迎的软件包,看看他们是怎么做到的。例如,在Django CMS中:
^{pr2}$cms/exceptions.py
(https://github.com/divio/django-cms/blob/develop/cms/exceptions.py)cms/utils/check.py
(https://github.com/divio/django-cms/blob/develop/cms/utils/check.py)相关问题 更多 >
编程相关推荐