0

I want to use SQL Server as the backend for Django.

I install pyodbc, django-pyodbc, django-pyodbc-azure

In settings.py I replace a Database

DATABASES = {
    'default': {
            'ENGINE': 'sql_server.pyodbc',
            'NAME': 'xxx',
            'USER': 'xxx',
            'PASSWORD': 'xxx',
            'HOST': 'xxx.database.windows.net',
            'PORT': '1433',
            'OPTIONS': {
                'driver': 'SQL Server Native Client 11.0',
                'MARS_Connection': 'True',
            }
        }
}

if I run python manage.py syncdb Error:

django.core.exceptions.ImproperlyConfigured: 'sql_server.pyodbc' isn't an available database backend. Available options are: 'dummy', 'mysql', 'oracle', 'postgresql', 'postgresql_psycopg2', 'sql_server', 'sqlite3'
Error was: No module named sql_server.pyodbc.base

I use Visual Studio + Python 2.7

1 Answer 1

3

You may want to follow that documentation https://azure.microsoft.com/en-us/documentation/articles/web-sites-python-ptvs-django-sql/. The Python tools for Visual Studio makes things easier; still, even if you don't use them, the documentation will show you how they do, how they install pyodbc locally, then push it to the server while publishing.

Note that while Azure has 64 bit VMs, the Python environment must be 32 bits.

Sign up to request clarification or add additional context in comments.

7 Comments

That's what i'm doing. In visual studio in step python -> django sync db -> error: Unknown command: 'syncdb' Type 'manage.py help' for usage. The Python REPL process has exited
are you in 32 bits as described in the documentation?
No, I think that is is my problem. Thank you. You know how I can install pip pyodbc for 64 bit?
the python tools for Visual Studio allow you to install with pip and easy_install in any virtual env. This is the easiest way to pip install.
I will edit the answer with the importance of 32 bits. If you think this answers your question, and once your issue is solved, can you please check this as an answer?
|

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.