0

I'm trying to run inspectdb and getting connection does not exist error! I have a database by name myapp in MySQL along with other databases.

This is my settings.py

DATABASES = {
'default': {
    'ENGINE':'django.db.backends.mysql',
    'NAME': 'myapp',
    'USER': '*****',
    'PASSWORD': '****',
    'HOST': 'ec2-11-111-111-11.compute-1.amazonaws.com',
    'PORT': '8000',
    }
}

Project structure:

mysite/
   manage.py
   mysite/
       settings.py

This is what happens:

root@ip-10-202-209-99:~/Desktop/mysite# python manage.py inspectdb --database myapp Traceback (most recent call last):
File "manage.py", line 10, in execute_from_command_line(sys.argv) File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django /core/management/init.py", line 399, in execute_from_command_line utility.execute()
File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/core/management/init.py", line 392, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
self.execute(*args, **options.dict)
File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
output = self.handle(*args, **options)
File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
return self.handle_noargs(**options)
File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 27, in handle_noargs
for line in self.handle_inspection(options):
File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/core/management/commands/inspectdb.py", line 33, in handle_inspection
connection = connections[options.get('database')]
File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/db/utils.py", line 196, in getitem
self.ensure_defaults(alias)
File "/home/ubuntu/.pyenv/versions/2.7.5/lib/python2.7/site-packages/django/db/utils.py", line 172, in ensure_defaults
raise ConnectionDoesNotExist("The connection %s doesn't exist" % alias)
django.db.utils.ConnectionDoesNotExist: The connection myapp doesn't exist

albertjan
  • 7,739
  • 6
  • 44
  • 74
Gopi
  • 216
  • 1
  • 3
  • 11

1 Answers1

0
 The connection myapp doesn't exist

This means that the database has not been created yet.

Aswin Murugesh
  • 10,831
  • 10
  • 40
  • 69
  • Yeah something like that. I can't seem to connect to any of the databases that are available. Am i missing some preliminary setup? – Gopi Feb 16 '14 at 14:43
  • It could easily take up so much of time. The contributing factors could be its a remote connection your working on, and also amount of data your working with, – Anup Feb 16 '14 at 14:46
  • that time i actually tried python manage.py inspectdb alone, without the database name. that is why it took so long. If i supply the db name, any db that exists, i am getting that error. Looks like i have some problem with my setting. – Gopi Feb 16 '14 at 14:59