1

I use django .

I create in this file models.py my model like this :

from django.db import models

class Poll(models.Model):
    question = models.CharField(max_length=200)
    pub_date = models.DateTimeField('date published')

class Choice(models.Model):
    poll = models.ForeignKey(Poll)
    choice_text = models.CharField(max_length=200)
    votes = models.IntegerField(default=0)

And I change this file settings.py like this

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'polls',
)

And I change mu database on SQL Server 2012

DATABASES = {
    'default': {
        'NAME': 'DjangoFirst',
        'ENGINE': 'sqlserver_ado',
        'HOST': 'PCClient',
        'USER': 'sa',
        'PASSWORD': 'sa',
    }
}

When I execute this command in Command prompt

python manage.py sql polls

I get this error :

django.core.exceptions.ImproperlyConfigured: 'sqlserver_ado' isn't an available
database backend.
Try using 'django.db.backends.XXX', where XXX is one of:
    u'mysql', u'oracle', u'postgresql_psycopg2', u'sqlite3'
Error was: No module named sqlserver_ado.base

What is(are) wrong ?

4
  • Don't think django supports SQL Server 2012 yet. Commented Nov 28, 2013 at 13:03
  • You did not get an answer that helps you? Commented Nov 28, 2013 at 14:11
  • not yet?your answer is about postgresql, but i want connect to sql server. and i found my answer in this post stackoverflow.com/questions/20265854/… Commented Nov 28, 2013 at 17:48
  • @Rohan Any news on when it might be supported? Commented Jul 18, 2014 at 18:09

3 Answers 3

1

You should to select needed backend module (see all availible modules in comment line). Correct this line:

ENGINE = 'postgresql_psycopg2' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'
Sign up to request clarification or add additional context in comments.

2 Comments

I want use SQL Server 2012 for my database?!?
Maybe to try this version of mssql backend?
1

The error message seems quite explicit: your default database settings are asking for a django database backend that cannot be found - either it does not exist or is not installed or you don't pass the correct python qualified name to your backend.

Comments

1

Finally I found the answer.

I most use from an another version of Django that support SQL Server 2012 and load that in my Python.

I think django-mssql 1.4rc2 is a good for my purpose.

This is "Python: Package Index > django-mssql" of version of Django that support SQL Server 2005 and later.

However , I can not use Django 1.6 and connect to SQL Server 2012 yet.

1 Comment

The next version of django-mssql will support Django 1.6 and Django 1.7. bitbucket.org/Manfre/django-mssql

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.