例如,我试图将两个非常有用的Django插件(widget)集成到我的项目中,在这两种情况下,当涉及到自定义和将代码插入设置时,我都遇到了问题。py公司
在这两种情况下,我都必须
customize
code
但我们没有设置。py在wagtail中,如果我尝试输入以下代码:
COUNTRIES_OVERRIDE = {
'XZ': _('Tibet')
}
(env) C:\Users\xakep\Documents\GitHub\database\blemmy>manage.py runserver
Traceback (most recent call last):
File "C:\Users\xakep\Documents\GitHub\database\blemmy\manage.py",
line 10, in <module> execute_from_command_line(sys.argv)
File "C:\Python36\lib\site-packages\django\core\management\__init__.py",
line 363, in execute_from_command_line utility.execute()
File "C:\Python36\lib\site-packages\django\core\management\__init__.py",
line 307, in execute settings.INSTALLED_APPS
File "C:\Python36\lib\site-packages\django\conf\__init__.py", line 56,
in__getattr__self._setup(name)
File "C:\Python36\lib\site-packages\django\conf\__init__.py", line 41,
in _setup self._wrapped = Settings(settings_module)
File "C:\Python36\lib\site-packages\django\conf\__init__.py", line 110,
in__init__ mod = importlib.import_module(self.SETTINGS_MODULE)
File "C:\Python36\lib\importlib\__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 978, in _gcd_import
File "<frozen importlib._bootstrap>", line 961, in _find_and_load
File "<frozen importlib._bootstrap>", line 950, in
_find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 655, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 205, in
_call_with_frames_removed
File "C:\Users\xakep\Documents\GitHub\database\blemmy\blemmy\settings\
__init__.py", line 1, in <module> from .dev import *
File "C:\Users\xakep\Documents\GitHub\database\blemmy\blemmy\settings\
dev.py", line 2, in <module> from .base import *
File "C:\Users\xakep\Documents\GitHub\database\blemmy\blemmy\settings\
base.py", line 112, in <module> 'XZ': _('Tibet')
NameError: name '_' is not defined
如果你能帮我(解释)如何在wagtail中使用类似的项目,我有很多好主意=)