I have installed Django 1.10. I need to import the loafing but not able to import it. I am trying to connect my django app with elasticsearch using Haystack and wanted to build index. The code I want to run is
python manage.py rebuild_index
The error I get is:
base ---dir
/Manish/Projects/Spark/ad-tracking-django-env/ad-tracking-django
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
utility.execute()
File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/__init__.py", line 341, in execute
django.setup()
File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/apps/config.py", line 199, 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 "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/catalog/models.py", line 79, in <module>
for model_cls in connected_models():
File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/catalog/utils.py", line 19, in connected_models
yield apps.cache.get_model(*model_str.split('.'))
AttributeError: 'Apps' object has no attribute 'cache'
According to my research the reason behind the error is because of the 'catalog' lib. Is there any alternative to this in Django 1.10? I have got 100s of errors even if I change a bunch of codes
Errors I have got are as follows:
ImportError: No module named util
ImportError: No module named loading
ImportError: No module named generic
Related
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/devbase/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
utility.execute()
File "/home/devbase/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute
django.setup()
File "/home/devbase/env/local/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/devbase/env/local/lib/python2.7/site-packages/django/apps/registry .py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/devbase/env/local/lib/python2.7/site-packages/django/apps/config.p y", line 94, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/devbase/env/local/lib/python2.7/site-packages/djorm_pgtrgm/__init_ _.py", line 1, in <module>
from django.db import backend
ImportError: cannot import name backend
It looks like you are using djorm_pgtrgm. It hasn't been updated for two years, so you can't expect it to work with recent versions of Django.
This merged pull request suggests that the import error has been fixed in the GitHub repo, but there hasn't been a release since then. You could try installing from source, but you should think about whether you want to use an unmaintained package in your project.
I am following an installation in lfs to insert a check out page in my website. I have copies all the instruction but after I tried to mia it produces an error.
(my_project) PS C:\my_project\src> python manage.py migrate
Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "C:\my_project\lib\site-
packages\django\core\management\__init__.py", line 367, in
execute_from_command_line
utility.execute()
File "C:\my_project\lib\site-
packages\django\core\management\__init__.py", line 341, in execute
django.setup()
File "C:\my_project\lib\site-packages\django\__init__.py", line 27, in
setup
apps.populate(settings.INSTALLED_APPS)
File "C:\my_project\lib\site-packages\django\apps\registry.py", line 85,
in populate
app_config = AppConfig.create(entry)
File "C:\my_project\lib\site-packages\django\apps\config.py", line 90, in
create
module = import_module(entry)
File "c:\python27\Lib\importlib\__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named lfs_theme
(my_project) PS C:\my_project\src>
Traceback:
Traceback (most recent call last):
File "my_script.py", line 16, in <module>
django.setup()
File "c:\Python27\lib\site-packages\django\__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "c:\Python27\lib\site-packages\django\apps\registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "c:\Python27\lib\site-packages\django\apps\config.py", line 112, in create
mod = import_module(mod_path)
File "c:\Python27\lib\importlib\__init__.py", line 37, in import_module
__import__(name)
File "c:\Python27\lib\site-packages\django\contrib\contenttypes\apps.py", line 7, in
<module>
from .management import update_contenttypes
ImportError: cannot import name update_contenttypes
The script used to run fine until I attempted to update django-allauth (which updated a ton of other packages: pytz, requests, oauthlib, requests-oauthlib, and Django (though I Ctrl-C'd when it started wanting to update Django. I am using Django 1.8.5)
I've installed django-google-analytics using: env/bin/pip install django-google-analytics with this response: Requirement already satisfied: django-google-analytics in ./env/lib/python2.7/site-packages.
I've added 'google_analytics', to INSTALLED_APPS and I've added GOOGLE_ANALYTICS_MODEL = True in settings.py
When I run env/bin/python manage.py syncdb I get ImportError: No module named google_analytics
What do I need to do?
EDIT
Here's the full Traceback if helpful
cache cleared
cache settings imported
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/henry/Documents/culture.folder/src/culturegymnkitchen/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/henry/Documents/culture.folder/src/culturegymnkitchen/env/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/home/henry/Documents/culture.folder/src/culturegymnkitchen/env/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/henry/Documents/culture.folder/src/culturegymnkitchen/env/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/henry/Documents/culture.folder/src/culturegymnkitchen/env/local/lib/python2.7/site-packages/django/apps/config.py", line 90, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named google_analytics
Issue was a new package being uploaded was changing django version being used. Once this was sorted it loaded.
I'm trying to run the following package from github - https://github.com/rollstudio/django-admin2-sb
But I'm getting the following traceback
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 385, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 354, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 21, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 87, in create
module = import_module(entry)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/djadmin2/__init__.py", line 13, in <module>
from . import core
File "/usr/local/lib/python2.7/dist-packages/djadmin2/core.py", line 14, in <module>
from . import apiviews
File "/usr/local/lib/python2.7/dist-packages/djadmin2/apiviews.py", line 12, in <module>
from .viewmixins import Admin2Mixin
File "/usr/local/lib/python2.7/dist-packages/djadmin2/viewmixins.py", line 15, in <module>
from braces.views import AccessMixin
ImportError: cannot import name AccessMixin
braces is installed I can see it in the following location -
/usr/local/lib/python2.7/dist-packages/braces/views
_access.py contains the class class AccessMixin(object):
so why doesn't it import?
In django-braces 1.3, views exported AccessMixin but in django-braces 1.4 this was moved to views._access and not exported in views.
This should be fixed in versions>1.4
Another workaround for this error is to downgrade django-braces to version 1.3.1.
Checkout this github issue: https://github.com/pydanny/django-admin2/issues/396