0
votes

I am beginner in Django framework and trying to connect Django project with MS sQL server on my localhost. I have tried a few of libs like pyodbc-azure but it is not working in my case and I am getting the errors.

"C:\Program Files\JetBrains\PyCharm 2018.1.5\bin\runnerw.exe" "C:\Program Files (x86)\Python37-32\python.exe" C:/Users/hyaqub/PycharmProjects/SpotDash/manage.py runserver 8000 Unhandled exception in thread started by .wrapper at 0x04A1BD68> Traceback (most recent call last): File "C:\Program Files (x86)\Python37-32\lib\site-packages\django_pyodbc\base.py", line 55, in import pyodbc as Database ImportError: DLL load failed: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\core\management\commands\runserver.py", line 109, in inner_run autoreload.raise_last_exception() File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line 248, in raise_last_exception raise _exception[1] File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\core\management__init__.py", line 337, in execute autoreload.check_errors(django.setup)() File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\utils\autoreload.py", line 225, in wrapper fn(*args, **kwargs) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\apps\registry.py", line 112, in populate app_config.import_models() File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\apps\config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "C:\Program Files (x86)\Python37-32\lib\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 967, in _find_and_load_unlocked File "", line 677, in _load_unlocked File "", line 728, in exec_module File "", line 219, in _call_with_frames_removed File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\contrib\auth\models.py", line 2, in from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\contrib\auth\base_user.py", line 47, in class AbstractBaseUser(models.Model): File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\models\base.py", line 101, in new new_class.add_to_class('_meta', Options(meta, app_label)) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\models\base.py", line 305, in add_to_class value.contribute_to_class(cls, name) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\models\options.py", line 203, in contribute_to_class self.db_table = truncate_name(self.db_table, connection.ops.max_name_length()) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db__init__.py", line 33, in getattr return getattr(connections[DEFAULT_DB_ALIAS], item) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\utils.py", line 202, in getitem backend = load_backend(db['ENGINE']) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django\db\utils.py", line 110, in load_backend return import_module('%s.base' % backend_name) File "C:\Program Files (x86)\Python37-32\lib\importlib__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "C:\Program Files (x86)\Python37-32\lib\site-packages\django_pyodbc\base.py", line 58, in raise ImproperlyConfigured("Error loading pyodbc module: %s" % e) django.core.exceptions.ImproperlyConfigured: Error loading pyodbc module: DLL load failed: The specified module could not be found.

Please guide me how can I achieve this. It would be appreciated.

1

1 Answers

2
votes

The error states that you are missing a DLL/module. I am not sure what process you went to install, but these instructions state that you need Install the Microsoft ODBC Driver for SQL Server on Windows, which should include all of the necessary DLL's