AttributeError: 'Settings' object has no attribute 'OSCAR_REQUIRED_ADDRESS_FIELDS' - python

i have this issue in django oscar when i execute python manage.py migrate i am a beginner in django oscar .any help and suggestions are welcome.
below is my error message.
#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'

by docs
The last addition to the settings file is to import all of Oscar’s default settings:
from oscar.defaults import *
more details install-by-hand, hope it help you

Related

upgrade to django 1.11.12 error in models/manager.py contribute_to_class

I haven't touched a project in a long time and realized I upgraded my django to version 1.11.12. Trying to re-run project (runserver) and found several out of date packages (easy-thumbnails and psycopg2). Ran pip install upgrade on those. Now when I run, I get the following error and it seems like it is coming form my models? Not sure what it is telling me though or the proper course of action. Maybe there was another upgrade step I missed when I upgraded to django 1.11? (sorry been ages since I touched this code)
Unhandled exception in thread started by <function wrapper at 0x104ab2500>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
autoreload.raise_last_exception()
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 251, in raise_last_exception
six.reraise(*_exception)
File "/usr/local/lib/python2.7/site-packages/django/utils/autoreload.py", line 228, in wrapper
fn(*args, **kwargs)
File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/shane.thomas/programming/sw_nga_site/swsite/models.py", line 12, in <module>
from filer.fields.image import FilerImageField
File "/usr/local/lib/python2.7/site-packages/filer/fields/image.py", line 4, in <module>
from ..models import Image
File "/usr/local/lib/python2.7/site-packages/filer/models/__init__.py", line 3, in <module>
from .clipboardmodels import * # flake8: noqa
File "/usr/local/lib/python2.7/site-packages/filer/models/clipboardmodels.py", line 9, in <module>
from . import filemodels
File "/usr/local/lib/python2.7/site-packages/filer/models/filemodels.py", line 18, in <module>
from .foldermodels import Folder
File "/usr/local/lib/python2.7/site-packages/filer/models/foldermodels.py", line 240, in <module>
mptt.register(Folder)
File "/usr/local/lib/python2.7/site-packages/mptt/__init__.py", line 12, in register
from mptt.models import MPTTModelBase
File "/usr/local/lib/python2.7/site-packages/mptt/models.py", line 379, in <module>
class MPTTModel(six.with_metaclass(MPTTModelBase, models.Model)):
File "/usr/local/lib/python2.7/site-packages/django/utils/six.py", line 808, in __new__
return meta(name, bases, d)
File "/usr/local/lib/python2.7/site-packages/mptt/models.py", line 262, in __new__
cls = super_new(meta, class_name, bases, class_dict)
File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", line 162, in __new__
new_class.add_to_class(obj_name, obj)
File "/usr/local/lib/python2.7/site-packages/django/db/models/base.py", line 325, in add_to_class
value.contribute_to_class(cls, name)
File "/usr/local/lib/python2.7/site-packages/mptt/managers.py", line 81, in contribute_to_class
super(TreeManager, self).contribute_to_class(model, name)
File "/usr/local/lib/python2.7/site-packages/django/db/models/manager.py", line 120, in contribute_to_class
setattr(model, name, ManagerDescriptor(self))
AttributeError: can't set attribute

PostgreSQL/PostGIS Stack builder missing dlls (GeoDjango)

I've installed GeoDjango Spatial Database libraries using Enterprise DB Stack for Postgres 10 and it includes following packages. I am using Windows 10 OS and needed to setup GeoDjango. Please assist
PostGIS 2.4.3 bundle includes
PostGIS 2.4.3 w
GDAL 2.2.3,
GEOS 3.6.2, Proj 4.9.3,
pgRouting 2.5.2,
osm2pgrouting 2.3.3,
ogr_fdw 1.0.5
But now on Python I get this error below and I tried many posted answers but couldn't make it work. Quick hint will be great help.
Below is the error:
(gigfinder) C:\Users\dell\gigfinder\gigfinder>python manage.py makemigrations
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\dell\gigfinder\lib\site-packages\django\core\management\__init__.py", line 350, in execute_from_command_line
utility.execute()
File "C:\Users\dell\gigfinder\lib\site-packages\django\core\management\__init__.py", line 324, in execute
django.setup()
File "C:\Users\dell\gigfinder\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Users\dell\gigfinder\lib\site-packages\django\apps\registry.py", line 108, in populate
app_config.import_models(all_models)
File "C:\Users\dell\gigfinder\lib\site-packages\django\apps\config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\auth\models.py", line 4, in <module>
from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\auth\base_user.py", line 49, in <module>
class AbstractBaseUser(models.Model):
File "C:\Users\dell\gigfinder\lib\site-packages\django\db\models\base.py", line 108, in __new__
new_class.add_to_class('_meta', Options(meta, app_label))
File "C:\Users\dell\gigfinder\lib\site-packages\django\db\models\base.py", line 299, in add_to_class
value.contribute_to_class(cls, name)
File "C:\Users\dell\gigfinder\lib\site-packages\django\db\models\options.py", line 263, in contribute_to_class
self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
File "C:\Users\dell\gigfinder\lib\site-packages\django\db\__init__.py", line 36, in __getattr__
return getattr(connections[DEFAULT_DB_ALIAS], item)
File "C:\Users\dell\gigfinder\lib\site-packages\django\db\utils.py", line 212, in __getitem__
backend = load_backend(db['ENGINE'])
File "C:\Users\dell\gigfinder\lib\site-packages\django\db\utils.py", line 116, in load_backend
return import_module('%s.base' % backend_name)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\db\backends\postgis\base.py", line 5, in <module>
from .features import DatabaseFeatures
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\db\backends\postgis\features.py", line 1, in <module>
from django.contrib.gis.db.backends.base.features import BaseSpatialFeatures
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\db\backends\base\features.py", line 4, in <module>
from django.contrib.gis.db.models import aggregates
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\db\models\__init__.py", line 2, in <module>
from django.contrib.gis.db.models.aggregates import * # NOQA
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\db\models\aggregates.py", line 1, in <module>
from django.contrib.gis.db.models.fields import ExtentField
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\db\models\fields.py", line 1, in <module>
from django.contrib.gis import forms
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\forms\__init__.py", line 3, in <module>
from .fields import ( # NOQA
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\forms\fields.py", line 4, in <module>
from django.contrib.gis.geos import GEOSException, GEOSGeometry
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\geos\__init__.py", line 5, in <module>
from .collections import ( # NOQA
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\geos\collections.py", line 9, in <module>
from django.contrib.gis.geos.geometry import (
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\geos\geometry.py", line 10, in <module>
from django.contrib.gis import gdal
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\gdal\__init__.py", line 48, in <module>
from django.contrib.gis.gdal.driver import Driver # NOQA
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\gdal\driver.py", line 5, in <module>
from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\gdal\prototypes\ds.py", line 9, in <module>
from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal
File "C:\Users\dell\gigfinder\lib\site-packages\django\contrib\gis\gdal\libgdal.py", line 48, in <module>
lgdal = CDLL(lib_path)
File "c:\python27\Lib\ctypes\__init__.py", line 366, in __init__
self._handle = _dlopen(self._name, mode)
WindowsError: [Error 126] The specified module could not be found

geodjango with mysql database

I am developing an application with geodjango and I have been running into some difficulties. following the procedures on the official django website https://docs.djangoproject.com/en/1.11/ref/contrib/gis/tutorial/#use-ogrinfo-to-examine-spatial-data . I first used the orginfo to check spatial data I got a failed message
FAILURE:
Unable to open datasource `world/data/TM_WORLD_BORDERS-0.3.shp' with the following drivers.
then I followed the remaining process creating the models and the error I got when I ran migration was
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/core/management/__init__.py", line 337, in execute
django.setup()
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models()
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/Olar/Desktop/arbithub/src/geolocation/models.py", line 5, in <module>
from django.contrib.gis.db import models
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/db/models/__init__.py", line 3, in <module>
from django.contrib.gis.db.models.aggregates import * # NOQA
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/db/models/aggregates.py", line 1, in <module>
from django.contrib.gis.db.models.fields import ExtentField
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/db/models/fields.py", line 3, in <module>
from django.contrib.gis import forms, gdal
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/forms/__init__.py", line 3, in <module>
from .fields import ( # NOQA
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/forms/fields.py", line 4, in <module>
from django.contrib.gis.geos import GEOSException, GEOSGeometry
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/geos/__init__.py", line 18, in <module>
HAS_GEOS = geos_version_info()['version'] >= '3.3.0'
File "/Users/Olar/Desktop/arbithub/lib/python2.7/site-packages/django/contrib/gis/geos/libgeos.py", line 196, in geos_version_info
raise GEOSException('Could not parse version info string "%s"' % ver)
django.contrib.gis.geos.error.GEOSException: Could not parse version info string "3.6.2-CAPI-1.10.2 4d2925d6"
.
further codes would b supplied based on request. Kindly help with it
The Could not parse version info string error is the issue in ticket 28441, which has been fixed in Django 1.11.5.
Note that it's always a good idea to use the latest point release (currently 1.11.5 for 1.11.X) to make sure you've got the latest security patches and bug fixes.

Django AttributeError: 'getfullargspec' object has no attribute 'default'

I teared down Django-oscar for practice and rebuild it not in capacity of a plugin app but as Django project. Now I am having this issue but couldn't figure out what it is related to exactly. Can someone help me to resolve this?
Following is the error I am getting:
When I run command "python manage.py shell" I get this error.
(supermarket) C:\Users\shazia\supermarket\market>python manage.py shell
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 354, in execute_from_command_line
utility.execute()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\_
_init__.py", line 346, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 394, in run_from_argv
self.execute(*args, **cmd_options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\b
ase.py", line 445, in execute
output = self.handle(*args, **options)
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 69, in handle
self.run_shell(shell=options['interface'])
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 58, in run_shell
return getattr(self, shell)()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 41, in ipython
ip()
File "C:\Users\shazia\supermarket\lib\site-packages\django\core\management\c
ommands\shell.py", line 34, in _ipython
from IPython import start_ipython
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\__init__.py", li
ne 47, in <module>
from .core.application import Application
File "C:\Users\shazia\supermarket\lib\site-packages\IPython\core\application
.py", line 22, in <module>
from traitlets.config.application import Application, catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\__init_
_.py", line 6, in <module>
from .application import *
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 120, in <module>
class Application(SingletonConfigurable):
File "C:\Users\shazia\supermarket\lib\site-packages\traitlets\config\applica
tion.py", line 291, in Application
def initialize(self, argv=None):
File "<decorator-gen-1>", line 2, in catch_config_error
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 232,
in decorate
evaldict, __wrapped__=func)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 219,
in create
self = cls(func, name, signature, defaults, doc, module)
File "C:\Users\shazia\supermarket\lib\site-packages\decorator.py", line 109,
in __init__
setattr(self, a, getattr(argspec, a))
AttributeError: 'getfullargspec' object has no attribute 'default'
You are on Windows as per the error description. Use 'manage.py shell' instead of 'python manage.py shell'.

Django and Tastypie API key signal connect yields ImportError: cannot import name User

In one of my django 1.6 apps, SOME_APP, I attempt to hook up a tastypie signal so that I can have API keys generated on User creation, as in the tastypie docs:
http://django-tastypie.readthedocs.org/en/latest/authentication.html
in MY_SITE/SOME_APP/signals.py I have:
from django.contrib.auth.models import User
from django.db import models
from tastypie.models import create_api_key
models.signals.post_save.connect(create_api_key, sender=User)
and in MY_SITE/SOME_APP/__init__.py I have:
from . import signals
When I attempt to run my development server, I get the following traceback:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
utility.execute()
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.__dict__)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/management/base.py", line 280, in execute
translation.activate('en-us')
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/utils/translation/__init__.py", line 130, in activate
return _trans.activate(language)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 188, in activate
_active.value = translation(language)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 177, in translation
default_translation = _fetch(settings.LANGUAGE_CODE)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/utils/translation/trans_real.py", line 159, in _fetch
app = import_module(appname)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/home/USER/git/MY_SITE/SOME_APP/__init__.py", line 5, in <module>
from . import signals
File "/home/USER/git/MY_SITE/SOME_APP/signals.py", line 12, in <module>
from tastypie.models import create_api_key
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/tastypie/models.py", line 32, in <module>
from tastypie.compat import AUTH_USER_MODEL
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/tastypie/compat.py", line 14, in <module>
User = get_user_model()
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 127, in get_user_model
user_model = get_model(app_label, model_name)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/db/models/loading.py", line 271, in get_model
self._populate()
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/debug_toolbar/models.py", line 63, in <module>
patch_root_urlconf()
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/debug_toolbar/models.py", line 51, in patch_root_urlconf
reverse('djdt:render_panel')
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 480, in reverse
app_list = resolver.app_dict[ns]
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 310, in app_dict
self._populate()
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 262, in _populate
for pattern in reversed(self.url_patterns):
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 346, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/core/urlresolvers.py", line 341, in urlconf_module
self._urlconf_module = import_module(self.urlconf_name)
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/home/USER/git/MY_SITE/MY_SITE/urls.py", line 13, in <module>
from SOME_APP.api.resources import PostResource #for tastypie REST API access
File "/home/USER/git/MY_SITE/SOME_APP/api/resources.py", line 6, in <module>
from tastypie.resources import ModelResource
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/tastypie/resources.py", line 19, in <module>
from tastypie.authentication import Authentication
File "/home/USER/.virtualenvs/virt-develop/local/lib/python2.7/site-packages/tastypie/authentication.py", line 14, in <module>
from tastypie.compat import User, username_field
ImportError: cannot import name User
What is causing this error and how can I fix it?
Thank you for any thoughts and suggestions :)

Categories

Resources