Forum Stats

  • 3,781,634 Users
  • 2,254,532 Discussions


Unable to connect to Django with oracle database

User_3A569 Member Posts: 2 Red Ribbon
edited Apr 5, 2019 12:53AM in Python

Hi all,

I'm trying to build my first web application using Django.

I'm actually referring to Using Python With Oracle Database 11g (under the section 'Using the Django Framework')

Steps followed

1. startproject myproj

2. cd myproj

3. python startapp myapp

4. Once the above commands were executed successfully, the next step was to modify the connection settings to allow the application to connect to the database in the file myproj/

Here i updated the details with our database details


    'default': {

        'ENGINE': '',

        'NAME': '<our ebs database name>',

'USER': <username>,

'PASSWORD': <password>,



5. Also added the project under the INSTALLED_APPS to associate the application with the project:










6. In a terminal window when i try to execute the below command from myproj directory:

python runserver

I'm getting the below error message

C:\Users\xxx\Desktop\Python files\myproj>python runserver

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x00000274CA28AEA0>

Traceback (most recent call last):

  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\", line 118, in create

    cls = getattr(mod, cls_name)

AttributeError: module 'myproj' has no attribute 'myapp'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\", line 225, in wrapper

    fn(*args, **kwargs)

  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\commands\", line 109, in inner_run


  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\", line 248, in raise_last_exception

    raise _exception[1]

  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\management\", line 337, in execute


  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\utils\", line 225, in wrapper

    fn(*args, **kwargs)

  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\", line 24, in setup


  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\", line 89, in populate

    app_config = AppConfig.create(entry)

  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\site-packages\django\apps\", line 123, in create


  File "C:\Users\xxx\AppData\Local\Programs\Python\Python37\lib\importlib\", 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 965, in _find_and_load_unlocked

ModuleNotFoundError: No module named 'myproj.myapp'

django error.PNG

Hoping someone can help me on how to rid of this error