Django connection to sql express 2017

Asked

Viewed 96 times

0

My python version is : 3.7.5 my Django version is : 3.0.2 when I ran the command 'Pip install Django-pyodbc-Azure' it uninstalled my Django version and installed version 2.1

In the file of Settings I am doing so : 'ENGINE': 'sql_server.pyodbc', 'NAME': 'project', 'USER': 'sa', 'PASSWORD': 'my password', 'HOST': 'the name of the host that enters the management studio', 'PORT': '1433', 'OPTIONS': { 'driver': 'ODBC Driver 13 for SQL Server'},

When running 'python Manage.py runserver' shows the sequence error : '[Microsoft][ODBC Driver 13 for SQL Server]A network-Related or instance-specific error has occurred while establishing a Connection to SQL Server. Server is not found or not accessible. Check if instance name is corre ct and if SQL Server is configured to allow remote Connections.'

The default server already allows remote connection.

  • Run this "Pip Freeze" command and put its output in question to check the installed version and modules.

  • returned that to me

  • asgiref==3.2.3 dj-Static==0.0.6 Django==2.1.15 Django-pyodbc-Azure==2.1.0.0 Django-stdimage==5.0.2 gunicorn==20.0.4 Pillow==7.0.0 bar2==3.47.0 psycopg2-Binary==2.8.4 pybc==4.0.28&#X;python-utils==2.3.0#Xa;pytz==2019.3 six==1.13.0
sqlparse==0.3.0
static3==0.7.0

  • I recommend you use the https://django-mssql.readthedocs.io/en/latest/quickstart.html. There is an answered question on the subject: https://stackoverflow.com/questions/49415188/connecting-django-to-mssql-server-express-2014-database

1 answer

0

How are you putting the HOST name ? It needs to contain the name or address of the computer and an instance ID defined during the installation procedure (SQLEXPRESS by default).

Use: 'HOST': 'COMPUTER-NAME\\SQLEXPRESS' or 'HOST': '127.0.0.1\\SQLEXPRESS'

You can also try to install a more current version of pyodbc, thus:

pip uninstall sql-server.pyodbc
pip install pyodbc

Browser other questions tagged

You are not signed in. Login or sign up in order to post.