Error Djongo MongoDB

161 views
Skip to first unread message

Kadir Guloglu

unread,
May 17, 2018, 5:09:18 PM5/17/18
to Django users
Hi

I am try to connect MongoDB and I am getting an exception

Thanks for help

CMD

c:\Proje\otomabakv2\otomabak\otomabak>python manage.py makemigrations
Traceback (most recent call last):
  File "manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 371, in execute_from_command_line
    utility.execute()
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\__init__.py", line 365, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv
    self.execute(*args, **cmd_options)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\base.py", line 335, in execute
    output = self.handle(*args, **options)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\management\commands\makemigrations.py", line 92, in handle
    loader.check_consistent_history(connection)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\loader.py", line 275, in check_consistent_history
    applied = recorder.applied_migrations()
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\recorder.py", line 61, in applied_migrations
    if self.has_table():
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\migrations\recorder.py", line 44, in has_table
    return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor())
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\introspection.py", line 56, in table_names
    return get_names(cursor)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\db\backends\base\introspection.py", line 51, in get_names
    return sorted(ti.name for ti in self.get_table_list(cursor)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\djongo\introspection.py", line 34, in get_table_list
    for c in cursor.db_conn.collection_names(False)]
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymongo\database.py", line 617, in collection_names
    for result in self.list_collections(session=session, **kws)]
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymongo\database.py", line 586, in list_collections
    ReadPreference.PRIMARY) as (sock_info, slave_okay):
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymongo\mongo_client.py", line 982, in _socket_for_reads
    server = topology.select_server(read_preference)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymongo\topology.py", line 224, in select_server
    address))
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymongo\topology.py", line 183, in select_servers
    selector, server_timeout, address)
  File "C:\Users\Kadir\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pymongo\topology.py", line 199, in _select_servers_loop
    self._error_message(selector))
pymongo.errors.ServerSelectionTimeoutError: localhost:27017: [WinError 10061] No connection could be made because the target machine actively refused it



DATABASES = {
"default": {
'ENGINE': 'djongo',
"NAME": "admin",
"host": "MONGO DB SERVER IP",
"PASSWORD": "PASSWORD",
"USER": "kadirguloglu1",
"PORT": 27017,
},
}

Ryan Nowakowski

unread,
May 18, 2018, 12:03:38 AM5/18/18
to Kadir Guloglu, Django users
Is your mongo host (IP) and port set correctly?

Aditya Singh

unread,
May 18, 2018, 12:10:28 AM5/18/18
to django...@googlegroups.com
Hi mate, 
This is the assured solution. This is because djongo looks for active mongo connection to connect. Download mongodb for your os and fire up mongod fron bin directory. Then create a folder named data/db in root disk drive. It should then work flawlessly.
Kind Regards,
Aditya

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/09517690-4673-4CCF-BBD5-B6DD33E7A655%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.

Kadir Guloglu

unread,
May 18, 2018, 2:55:38 AM5/18/18
to Django users
Sorry I don't understand :(

18 Mayıs 2018 Cuma 07:10:28 UTC+3 tarihinde Aditya Singh yazdı:

1803...@qq.com

unread,
May 18, 2018, 7:06:18 AM5/18/18
to Django users
test

在 2018年5月18日星期五 UTC+10上午7:09:18,Kadir Guloglu写道:
Reply all
Reply to author
Forward
0 new messages