C: \ Program Files Python \ mysite> python manage.py makemigrations polls Traceback (most recent call last): File "manage.py", line 22, in execute_from_command_line (sys.argv) File "C: \ Python27 \ lib \ site-packages \ django \ core \ management__init __. Py", line 363, in execute_from_command_line utility.execute () File "C: \ Python27 \ lib \ site-packages \ django \ core \ management__init __. Py", line 337, in execute django.setup () File "C: \ Python27 \ lib \ site-packages \ django__init __. Py", line 27, in setup apps.populate (settings.INSTALLED_APPS) File "C: \ Python27 \ lib \ site-packages \ django \ apps \ registry.py", line 108, in populate app_config.import_models () File "C: \ Python27 \ 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: \ Python27 \ lib \ site-packages \ django \ contrib \ auth \ models.py", line 4, in from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "C: \ Python27 \ lib \ site-packages \ django \ contrib \ auth \ base_user.py", line 52, in class AbstractBaseUser (models.Model): File "C: \ Python27 \ lib \ site-packages \ django \ db \ models \ base.py", line 124, in new new_class.add_to_class ('_ meta', Options (meta, app_label)) File "C: \ Python27 \ lib \ site-packages \ django \ db \ models \ base.py", line 330, in add_to_class value.contribute_to_class (cls, name) File "C: \ Python27 \ lib \ site-packages \ django \ db \ models \ options.py", line 214, in contribute_to_class self.db_table = truncate_name (self.db_table, connection.ops.max_name_length ()) File "C: \ Python27 \ lib \ site-packages \ django \ db__init __. Py", line 33, in getattr return getattr (connections [DEFAULT_DB_ALIAS], item) File "C: \ Python27 \ lib \ site-packages \ django \ db \ utils.py", line 212, in getitem conn = backend.DatabaseWrapper (db, alias) File "C: \ Python27 \ lib \ site-packages \ sqlserver_ado \ base.py", line 184, in init super (DatabaseWrapper, self). init (* args, ** kwargs) C: \ Python27 \ lib \ site-packages \ django \ db \ backends \ base \ base.py ", line 97, in init self.creation = self.creation_class (self) TypeError: Error when calling the metaclass bases 'NoneType' object is not callable
When issuing this error can it be a problem with the connection?
Below the database settings I'm using Django and the template I edited from polls
.
settings.py
DATABASES = {
'default': {
'NAME': 'MS_PYTHON',
'ENGINE': 'sqlserver_ado',
'HOST': 'UDILAN-PC\SQLEXPRESS',
'USER': 'sa',
'PASSWORD': 'vorlon',
'PORT': '',
'OPTIONS': {
'provider': 'SQLOLEDB',
'use_mars': True,
}
}
}
models.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models
# Create your models here.
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)