Reputation: 104
I've installed Django on CentOS 7.0 version.
#yum install python-pip
#pip install django
#cd /home
#django-admin startproject mysite
#cd mysite
#python manage.py runserver 0.0.0.0:8000
and when I go to http://domain.com:8000 on the web browser, I see below errors.
ImportError at /
cannot import name Col
Request Method: GET
Request URL: http://domain.com:8000/
Django Version: 1.6.10
Exception Type: ImportError
Exception Value:
cannot import name Col
Exception Location: /usr/lib/python2.7/site-packages/django/contrib/contenttypes/fields.py in <module>, line 13
Python Executable: /usr/bin/python
Python Version: 2.7.5
It should work on CentOS 6.3 but I think it is different on CentOS 7.0
I looked fields.py file
============================================
from __future__ import unicode_literals
from collections import defaultdict
from django.core import checks
from django.core.exceptions import ObjectDoesNotExist
from django.db import connection
from django.db import models, router, transaction, DEFAULT_DB_ALIAS
from django.db.models import signals, FieldDoesNotExist, DO_NOTHING
from django.db.models.base import ModelBase
from django.db.models.fields.related import ForeignObject, ForeignObjectRel
from django.db.models.related import PathInfo
from django.db.models.sql.datastructures import Col
from django.contrib.contenttypes.models import ContentType
from django.utils import six
from django.utils.deprecation import RenameMethodsBase, RemovedInDjango18Warning
It was like this.
Upvotes: 2
Views: 1097
Reputation: 74
For the benefit of other folks here is my suggestion - The repos usually install the available package. Reinstalling will reinstall the same buggy package again. For python based projects use the code
sudo pip install Django==1.8.1
#version
(Make sure python-pip is installed before using the command)
instead of sudo yum -y install python-django
# in RHEL, Fedora
Upvotes: 0
Reputation: 76
I had the same issue with a Django installation I was working on, and it turned out that fields.py was leftover from a newer version of Django (1.7.x) that I had (probably improperly) downgraded from. I uninstalled Django, removed the remaining Django directories under site-packages, then reinstalled it, and that fixed the problem.
Upvotes: 2