Setting DATABASE_URL for my MySQL DB fails for a Django App


Hi there,

I’m new to Aptible, so forgive me if this is a silly question. I’m trying to deploy a very simple Django App with a MySQL DB as backend to the Aptible development environment.

In my file I’ve set this:

  'default': dj_database_url.config()

And then as a variable to my app, I’ve set the DATABASE_URL returned from creating the DB, with something like this

aptible config:set --app "app-dev" "DATABASE_URL=mysql://"

… with the copy/pated URL from the DB credentials (I’ve replaced the password with foo_bar only for the purposes of this question).

When I try to deploy, I get this error message:

remote: INFO -- : django.db.utils.OperationalError: (1045, "Access denied for user 'aptible'@'ip-10-51-7-101.ec2.internal' (using password: YES)")
remote: ERROR -- : Prerelease commands failed: Non-zero exit code from command: 1.

Any thoughts on why this might be happening? The docs seem to suggest that this should work out of the box.



I’m going to answer my own question in case this happens to somebody else in the future.

I filed a support ticket and Frank was really helpful in his response.

The solution was to force Django to use SSL.

In I had to add this:

aptibleConfig = dj_database_url.config() 
aptibleConfig['OPTIONS'] = { 
  'ssl': { 
    'cipher': 'DHE-RSA-AES256-SHA' 

DATABASES = { 'default': aptibleConfig } 

That fixed it! Thanks Aptible!