我在django oscar执行时遇到这个问题,我是django oscar的初学者,欢迎任何帮助和建议。
下面是我的错误信息。

@localhost production1]$ python manage.py makemigrations
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/usr/lib64/python2.7/site-packages/django/core/management/__init__.py", line 337, in execute
    django.setup()
  File "/usr/lib64/python2.7/site-packages/django/__init__.py", line 27, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "/usr/lib64/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models()
  File "/usr/lib64/python2.7/site-packages/django/apps/config.py", line 202, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/usr/lib/python2.7/site-packages/oscar/apps/address/models.py", line 1, in <module>
    from oscar.apps.address.abstract_models import (
  File "/usr/lib/python2.7/site-packages/oscar/apps/address/abstract_models.py", line 19, in <module>
    class AbstractAddress(models.Model):
  File "/usr/lib/python2.7/site-packages/oscar/apps/address/abstract_models.py", line 35, in AbstractAddress
    POSTCODE_REQUIRED = 'postcode' in settings.OSCAR_REQUIRED_ADDRESS_FIELDS
  File "/usr/lib64/python2.7/site-packages/django/conf/__init__.py", line 57, in __getattr__
    val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'OSCAR_REQUIRED_ADDRESS_FIELDS'

最佳答案

按文档
最后添加到设置文件的是导入Oscar的所有默认设置:

from oscar.defaults import *

更多细节,希望对您有所帮助

关于python - AttributeError:“设置”对象没有属性“OSCAR_REQUIRED_ADDRESS_FIELDS”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/45690235/

10-09 02:48