IBM / django-ibmi

Django adapter for IBM i
Apache License 2.0
3 stars 5 forks source link

Error when trying to run python manage.py shell - missing 1 required positional argument: 'settings_dict' #55

Open richardschoen opened 1 year ago

richardschoen commented 1 year ago

Following error occurs: when I run: python manage.py shell - TypeError: init() missing 1 required positional argument: 'settings_dict'

Using Django 3.2.18 with Python 3.7.

From what I can tell there's an error in the base.py module, for django_ibmi but I don't know how to troubleshoot this code.

I don't think you should have to pass the settings_dict into the database drivers constructor. That should happen automatically.

You may want to take a look at this project which seems to work as expected for reference. Lots of similar code.
https://github.com/soundstripe/django-pyodbc-iseries

Settings I used. There's appears to be a typo in the docs. I believe it should be django_ibmi instead of django-ibmi for the ENGINE parm as it is in the docs.

DATABASES = {
     'default': {
        'ENGINE': 'django_ibmi',
        'NAME': 'ibmi1',
        'USER': 'USER1',
        'PASSWORD': 'PASS1',
    }
}

Full error:

c:\gitrepos\DjangoWebProject1\DjangoWebProject1>python manage.py shell
Traceback (most recent call last):
  File "manage.py", line 24, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\__init__.py", line 419, in execute_from_command_line
    utility.execute()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\__init__.py", line 395, in execute
    django.setup()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\__init__.py", line 24, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\apps\registry.py", line 114, in populate
    app_config.import_models()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\apps\config.py", line 301, in import_models
    self.models_module = import_module(models_module_name)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\importlib\__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 728, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\contrib\auth\models.py", line 3, in <module>
    from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManager
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\contrib\auth\base_user.py", line 48, in <module>
    class AbstractBaseUser(models.Model):
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\models\base.py", line 122, in __new__
    new_class.add_to_class('_meta', Options(meta, app_label))
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\models\base.py", line 326, in add_to_class
    value.contribute_to_class(cls, name)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\models\options.py", line 207, in contribute_to_class
    self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\connection.py", line 15, in __getattr__
    return getattr(self._connections[self._alias], item)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\connection.py", line 62, in __getitem__
    conn = self.create_connection(alias)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\utils.py", line 205, in create_connection
    return backend.DatabaseWrapper(db, alias)
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django_ibmi\base.py", line 119, in __init__
    self.databaseWrapper = DatabaseWrapper()
  File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django_ibmi\base.py", line 110, in __init__
    super().__init__(*args)
TypeError: __init__() missing 1 required positional argument: 'settings_dict'