-
寫入
stdout
或stderr
時有助於創建彩色輸出的實例屬性。例如:self.stdout.write(self.style.SUCCESS('...'))
請參閱語法著色以了解如何修改調色板並查看可用樣式(使用該部分中說明的 “roles” 的大寫版本)。
如果在運行命令時傳遞
--no-color
self.style()
調用都將返回未著色的原始字符串。
本文介紹 django.core.management.BaseCommand.style
的用法。
聲明
BaseCommand.style
相關用法
- Python Django BaseFormSet.get_ordering_widget用法及代碼示例
- Python BaseException.with_traceback用法及代碼示例
- Python Django BaseFormSet.ordering_widget用法及代碼示例
- Python Django BoolOr用法及代碼示例
- Python Django BoundField.label_tag用法及代碼示例
- Python Django BoundField.id_for_label用法及代碼示例
- Python PIL BoxBlur()用法及代碼示例
- Python Bytes轉Int用法及代碼示例
- Python Bytes轉String用法及代碼示例
- Python Django BoundField.initial用法及代碼示例
- Python Django BoundField.value用法及代碼示例
- Python Binary轉Hexadecimal用法及代碼示例
- Python Django BoolAnd用法及代碼示例
- Python Django BoundField.css_classes用法及代碼示例
- Python Django BoundField.errors用法及代碼示例
- Python Django BoundField.data用法及代碼示例
- Python Django BoundField.name用法及代碼示例
- Python Django BoundField.widget_type用法及代碼示例
- Python cudf.core.column.string.StringMethods.is_vowel用法及代碼示例
- Python torch.distributed.rpc.rpc_async用法及代碼示例
- Python torch.nn.InstanceNorm3d用法及代碼示例
- Python sklearn.cluster.MiniBatchKMeans用法及代碼示例
- Python pandas.arrays.IntervalArray.is_empty用法及代碼示例
- Python tf.compat.v1.distributions.Multinomial.stddev用法及代碼示例
- Python numpy.less()用法及代碼示例
注:本文由純淨天空篩選整理自djangoproject.com大神的英文原創作品 django.core.management.BaseCommand.style。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。