I am trying to convert a Django 1.3 app to Django 1.6. I am using the django-tracking package but when I start the runsever I get the following error:
Unhandled exception in thread started by <function wrapper at 0x10868e9b0>
Traceback (most recent call last):
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
self.validate(display_num_errors=True)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/tracking/models.py", line 5, in <module>
from django.contrib.gis.utils import HAS_GEOIP
ImportError: cannot import name HAS_GEOIP
The answer is here:
https://docs.djangoproject.com/en/1.4/ref/contrib/gis/geoip/#module-django.contrib.gis.geoip
In Django 1.6 the import needed has changed from:
from django.contrib.gis.utils import HAS_GEOIP
to:
from django.contrib.gis.geoip import HAS_GEOIP
You could try to install development version of django-tracking with
pip install git+https://github.com/bashu/django-tracking.git
Related
When I write pip list, I can see django there. When I write import django in python shell, there is no error. But when I write python manage.py runserver it gives me the following error:
Unhandled exception in thread started by <function wrapper at 0x105838b18>
Traceback (most recent call last):
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 117, in inner_run
autoreload.raise_last_exception()
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/utils/autoreload.py", line 250, in raise_last_exception
six.reraise(*_exception)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
fn(*args, **kwargs)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/__init__.py", line 27, in setup
apps.populate(settings.INSTALLED_APPS)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/Users/manitgupta/virtualenvs/testify/lib/python2.7/site-packages/django/apps/config.py", line 127, in create
import_module(entry)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named django
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 am trying to setup Hue on my Mac.
This is the GitHub link I referred to:
https://github.com/cloudera/hue#development-prerequisites
$ git clone https://github.com/cloudera/hue.git
$ cd hue
$ make apps
Getting this error:: when running build/env/bin/hue runserver
hue soundarya$ build/env/bin/hue runserver
Validating models...
Unhandled exception in thread started by <function wrapper at 0x108be1cf8>
Traceback (most recent call last):
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/utils/autoreload.py", line 93, in wrapper
fn(*args, **kwargs)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/commands/runserver.py", line 102, in inner_run
self.validate(display_num_errors=True)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/base.py", line 310, in validate
num_errors = get_validation_errors(s, app)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/management/validation.py", line 34, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 196, in get_app_errors
self._populate()
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 78, in _populate
self.load_app(app_name)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/models/loading.py", line 99, in load_app
models = import_module('%s.models' % app_name)
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/utils/importlib.py", line 40, in import_module
__import__(name)
File "/Users/soundarya/virtenv/hue_venv/hue/apps/jobbrowser/src/jobbrowser/models.py", line 20, in <module>
import lxml.html
File "/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/html/__init__.py", line 42, in <module>
from lxml import etree
ImportError: dlopen(/Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/etree.so, 2): Library not loaded: libxml2.2.dylib
Referenced from: /Users/soundarya/virtenv/hue_venv/hue/build/env/lib/python2.7/site-packages/lxml-3.3.6-py2.7-macosx-10.11-intel.egg/lxml/etree.so
Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0
Can anyone help me with this issue?
Prerequisites are not yet satisfied. You have to install all the requirements listed here: Development Prerequisites. To ged rid of this error, you have to install python2.7-dev package(not python2.7-devel) and also other requirements.
after running
python manage.py runserver 0.0.0.0:8000
I get this error message
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x7fefc10b9190>>
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/runserver.py", line 92, in inner_run
self.validate(display_num_errors=True)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 280, in validate
num_errors = get_validation_errors(s, app)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 75, in _populate
self.load_app(app_name)
File "/usr/local/lib/python2.7/dist-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/cms/models/__init__.py", line 3, in <module>
from .pagemodel import * # nopyflakes
File "/usr/local/lib/python2.7/dist-packages/cms/models/pagemodel.py", line 6, in <module>
from django.contrib.auth import get_permission_codename
ImportError: cannot import name get_permission_codename
I've checked out /django/contrib/auth/management/init.py
and the get_permission_codename function exists so I can't see why it's not getting imported.
First, make sure you have Django 1.6 or later installed, because that's when get_permission_codename was added.
The problem might be with old pyc files. You could get rid of these by uninstalling Django completely then reinstalling.
Hi I am using Mac OS (SnowLeopard). I have python installed by default which I guess is 2.6.
I installed python 3.3 from the python server and now installed django also.
I created a django project using STARTPROJECT and tried to run it using manage.py runserver.
I get errors, but from the error its evident that the python getting used still is 2.6
How to change this?
The error is as
Unhandled exception in thread started by <bound method Command.inner_run of <django.contrib.staticfiles.management.commands.runserver.Command object at 0x10169aed0>>
Traceback (most recent call last):
File "/Library/Python/2.6/site-packages/django/core/management/commands/runserver.py", line 92, in inner_run
self.validate(display_num_errors=True)
File "/Library/Python/2.6/site-packages/django/core/management/base.py", line 280, in validate
num_errors = get_validation_errors(s, app)
File "/Library/Python/2.6/site-packages/django/core/management/validation.py", line 35, in get_validation_errors
for (app_name, error) in get_app_errors().items():
File "/Library/Python/2.6/site-packages/django/db/models/loading.py", line 166, in get_app_errors
self._populate()
File "/Library/Python/2.6/site-packages/django/db/models/loading.py", line 72, in _populate
self.load_app(app_name, True)
File "/Library/Python/2.6/site-packages/django/db/models/loading.py", line 96, in load_app
models = import_module('.models', app_name)
File "/Library/Python/2.6/site-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/Library/Python/2.6/site-packages/django/contrib/auth/models.py", line 21, in <module>
from django.contrib.contenttypes.models import ContentType
File "/Library/Python/2.6/site-packages/django/contrib/contenttypes/models.py", line 127, in <module>
class ContentType(models.Model):
File "/Library/Python/2.6/site-packages/django/db/models/base.py", line 97, in __new__
new_class.add_to_class('_meta', Options(meta, **kwargs))
TypeError: Error when calling the metaclass bases
__init__() keywords must be strings