2

I am building a simple web app using django as my backend and mongodb as a database. I have set up the settings.py file correctly like so:

Image of my settings.py

The error i get when i try to migrate my data to database:

Error

Traceback (most recent call last):
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\djongo\database.py", line 10, in connect
    return clients[db]
KeyError: 'django'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Web\ToDo Projekat\ToDoList\Back\toDo\manage.py", line 22, in <module>
    main()
  File "C:\Web\ToDo Projekat\ToDoList\Back\toDo\manage.py", line 18, in main
    execute_from_command_line(sys.argv)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 446, in execute_from_command_line
    utility.execute()
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\__init__.py", line 440, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 402, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 448, in execute
    output = self.handle(*args, **options)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\base.py", line 96, in wrapped
    res = handle_func(*args, **kwargs)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\core\management\commands\migrate.py", line 114, in handle
    executor = MigrationExecutor(connection, self.migration_progress_callback)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\executor.py", line 18, in __init__
    self.loader = MigrationLoader(self.connection)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\loader.py", line 58, in __init__
    self.build_graph()
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\loader.py", line 235, in build_graph
    self.applied_migrations = recorder.applied_migrations()
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\recorder.py", line 81, in applied_migrations
    if self.has_table():
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\migrations\recorder.py", line 57, in has_table
    with self.connection.cursor() as cursor:
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 323, in cursor
    return self._cursor()
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 299, in _cursor
    self.ensure_connection()
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 282, in ensure_connection
    self.connect()
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\utils\asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\django\db\backends\base\base.py", line 263, in connect
    self.connection = self.get_new_connection(conn_params)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\djongo\base.py", line 176, in get_new_connection
    self.client_connection = Database.connect(db=name, **connection_params)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\djongo\database.py", line 13, in connect
    clients[db] = MongoClient(**kwargs, connect=False)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\mongo_client.py", line 718, in __init__
    self.__options = options = ClientOptions(
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\client_options.py", line 165, in __init__
    self.__pool_options = _parse_pool_options(options)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\client_options.py", line 132, in _parse_pool_options
    ssl_context, ssl_match_hostname = _parse_ssl_options(options)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\client_options.py", line 98, in _parse_ssl_options
    ctx = get_ssl_context(
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\site-packages\pymongo\ssl_support.py", line 148, in get_ssl_context
    ctx.load_default_certs()
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 574, in load_default_certs
    self._load_windows_store_certs(storename, purpose)
  File "C:\Users\dZoNi\AppData\Local\Programs\Python\Python39\lib\ssl.py", line 566, in _load_windows_store_certs
    self.load_verify_locations(cadata=certs)
ssl.SSLError: [ASN1] nested asn1 error (_ssl.c:4144)

This is the error log.

And i do have a database called django created on my MongoDB cluster:

Cluster

dzoni_K
  • 21
  • 2

0 Answers0