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