Strange deployment problem

57 views
Skip to first unread message

Miloš Kozák

unread,
Mar 27, 2015, 10:25:36 AM3/27/15
to django...@googlegroups.com
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

Anderson Resende

unread,
Mar 28, 2015, 9:21:20 AM3/28/15
to django...@googlegroups.com

I don't used mysql,but in postgres for you write in a database your user db needs permission to write.
Check that!

Gergely Polonkai

unread,
Mar 28, 2015, 9:53:13 AM3/28/15
to django...@googlegroups.com

Hello,

do you have command line access on that machine? If so, can you connect to the database using the credentials in the settings file?

Best,
Gergely

On 28 Mar 2015 14:21, "Anderson Resende" <anderson...@gmail.com> wrote:

I don't used mysql,but in postgres for you write in a database your user db needs permission to write.
Check that!

--
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 http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/b0eba252-8c3e-4b51-ab38-ea7f04df3a69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Miloš Kozák

unread,
Mar 28, 2015, 12:38:50 PM3/28/15
to django...@googlegroups.com
Sure, those credentials work.

If you look at the last line of the error output you can see that django wants to use user root whereas I am using user demo

Miloš Kozák

unread,
Apr 2, 2015, 4:49:54 AM4/2/15
to django...@googlegroups.com
I have just found, that if I use tmux then everything works perfect... Maybe this might be caused by some system variables forced by my terminal?

This problem denies me to use Fabric for DB updates! This is very big constraint.
Reply all
Reply to author
Forward
0 new messages