Friday, March 27, 2015

Strange deployment problem

Hi,

I have rather strange problem with already deployed application. I added some new ACL rules which I need to write to the database, so I wanted to call syncdb --all. However, using the command:

./manage.py syncdb

or

./manage.py syncdb --settings=intranet.settings.demo

I get this:
Syncing...
Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 399, in execute_from_command_line
    utility.execute()
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 392, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/core/management/base.py", line 242, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/core/management/base.py", line 285, in execute
    output = self.handle(*args, **options)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/core/management/base.py", line 415, in handle
    return self.handle_noargs(**options)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/south/management/commands/syncdb.py", line 89, in handle_noargs
    db.connection_init()
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/south/db/mysql.py", line 183, in connection_init
    cursor = self._get_connection().cursor()
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 162, in cursor
    cursor = util.CursorWrapper(self._cursor(), self)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 132, in _cursor
    self.ensure_connection()
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/db/utils.py", line 99, in __exit__
    six.reraise(dj_exc_type, dj_exc_value, traceback)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 127, in ensure_connection
    self.connect()
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/db/backends/__init__.py", line 115, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 435, in get_new_connection
    conn = Database.connect(**conn_params)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
    return Connection(*args, **kwargs)
  File "/var/www/demo/libs/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
    super(Connection, self).__init__(*args, **kwargs2)
django.db.utils.OperationalError: (1045, "Access denied for user 'root'@'localhost' (using password: YES)")

As it is seems straightforward problem with wrong credentials, it is more complicated! I use special configuration file which is stored in intranet/settings/demo.py, and here I have:

DATABASES = {
    'default': {
         'ENGINE': "django.db.backends.mysql",
         "NAME": "demo",
         "USERNAME": "demo",
         "PASSWORD": "XXXXXXXXX",
         "HOST": "localhost"
    }
}

which means I do not use root with empty password.


I have Django 1.6.11, Debian stable which is up-to-date.


The strange thing is if I try different configurations at my desktop with Debian Jessy these alternative configuration files (profiles) work perfectly!

Also, if I try MobaXterm syncdb works just fine. Do you think it could be related to some system variables? I have got no clue!


I will be glad for any hint!

Thank you, Milos

--
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+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/77ef1b04-720f-4efc-9159-593e9ea3476d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment