Search code examples
pythonmysqldjangomysql-error-1045

Can't access MySQL database in Django VirtualEnv on localhost


I have had a virtualenv for Trunk up and running for a while, but now I am trying to branch, and get things setup on another virtualenv for my 'refactor' branch.

Everything looks to be setup correctly, but when I try to run any manage.py commands, I get this error:

_mysql_exceptions.OperationalError: (1045, "Access denied for user 'brian'@'localhost' (using password: NO)")

I just don't understand why it's not attempting to use the password I have set in my django settings file. Is there some addition mysql setup I could have overlooked? Does this issue ring any bells for anyone?

Thanks in advance.


Solution

  • I found the problem I was having. Django was importing a different settings.py file.

    I had another django project inside my django product like myproject/myproject/.

    Instead of importing myproject/settings.py, it was importing myproject/myproject/settings.py

    I assume that Aptana Studio created that project there. If you use eclipse you are also likely to have this problem.