Home > other >  Django how to use the MDB database?
Django how to use the MDB database?

Time:11-30

Installed pyodbc, download the django - pyodbc - access components at the same time, access to copy to my project exa1, used in my project directory: python manage. Py makemigrate after an error,
PS D: \ source_code \ Django \ exa1 & gt; Python manage. Py makemigrate
Traceback (the most recent call last) :
The File "is the manage. Py", line 22, in & lt; module>
Execute_from_command_line (sys. Argv)
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django/core/management/set py", line 401, in execute_from_command_line
The utility. The execute ()
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django/core/management/set py", line 377, in the execute
Django. The setup ()
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ set py", line 24, setup in
Apps. The populate (Settings. The INSTALLED_APPS)
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ apps \ registry py", line 114, in the populate
App_config. Import_models ()
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ apps \ config py", line 211, in import_models
Self. Models_module=import_module (models_module_name)
The File "D: \ \ Program Files \ Python \ lib \ importlib \ set py", line 127, in import_module
Return _bootstrap. _gcd_import (name [level:], package, level)
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 1006, in _gcd_import
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 983, in _find_and_load
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 967, in _find_and_load_unlocked
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 677, in _load_unlocked
The File "& lt; Frozen importlib. _bootstrap_external & gt;" , line 728, in exec_module
The File "& lt; Frozen importlib. _bootstrap & gt;" , line 219, in _call_with_frames_removed
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ contrib \ auth \ models py", line 2, the in & lt; module>
The from the django. Contrib. Auth. Base_user import AbstractBaseUser, BaseUserManager
The File "D: \ \ Program Files \ Python \ lib \ site - packages \ django \ contrib \ auth \ base_user py", line 47, in & lt; module>
The class AbstractBaseUser (models. Model) :
The File "D: \ \ Program Files \ Python \ lib \ site - packages \ django \ db \ models \ base py", line 121, in __new__
New_class. Add_to_class (' _meta 'Options (meta, app_label))
The File "D: \ \ Program Files \ Python \ lib \ site - packages \ django \ db \ models \ base py", line 325, in add_to_class
Value. Contribute_to_class (CLS, name)
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ db \ models \ options py", line 208, in contribute_to_class
Self. Db_table=truncate_name (self. Db_table, connection. Ops. Max_name_length ())
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ db \ set py", 28, the line in __getattr__
Return getattr (connections [DEFAULT_DB_ALIAS], item)
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ db \ utils py", line 207, in the __getitem__
Backend=load_backend (db [' ENGINE '])
File "D: \ \ Program Files \ lib \ site - packages \ \ Python django \ db \ utils py", line 111, in load_backend
S.b ase return import_module (' % '% backend_name)
The File "D: \ \ Program Files \ Python \ lib \ importlib \ set py", line 127, in import_module
Return _bootstrap. _gcd_import (name [level:], package, level)
The File "D: \ source_code \ Django \ exa1 \ access \ pyodbc \ base py", line 8
Except ImportError, e:
^
SyntaxError: invalid syntax

Want to how to deal with, please? Contact time is short, give advice or comments please master, thank you.

CodePudding user response:

In the Settings.
is installed inside the pyINSTALLED_APPS=[
'the django. Contrib. Admin,
'the django. Contrib. Auth',
'the django. Contrib. Contenttypes',
'the django. Contrib. Sessions',
'the django. Contrib. Messages',
'the django. Contrib. Staticfiles',
'access',
'exa1'
]

The DATABASES={
"Default" : {
'ENGINE', 'access. Pyodbc',
'NAME' : 'jamisDB',
'OPTIONS' : {
'driver', 'Microsoft Access driver (*. MDB)',
'DSN' : 'jamisDB. MDB,
'user' : 'admin',
'password' : ' ',
}
# 'DSN' : "DRIVER={Microsoft Access DRIVER (*. MDB, *. Accdb)}; DBQ=..//..//Delphi//JAMIS_1//Bin//jamisDB MDB. Uid=; The Pwd=;"
},
}
I don't know where is the problem? Please give advice or comments
  • Related