I have been doing my first deployment with django (ever), and I am using Heroku CLI.
I get this message when trying to run tests:
“Got an error creating the test database: permission denied to create database”
I tried first just by running tests. Then I tried to specify the current database as a test option (giving same parameters). I also tried to specify Sqlite as a test database.
I am expecting to have a temporal database for testing, or to use the current database for it.
I have found an option that creates a custom connection to a postgress database made for only testing purposes. It seems too complicated to be a common problem. I also saw something in heroku pages called dynos database (a temporal one for testing in Ruby), but could not find it in the add ons on the page, nor when trying to do it from the command line (it says its only for command line deployment).
Implementing something like what pasted bellow would be ideal as it makes a database temporaly only for testing (found in Ruby section):
https://devcenter.heroku.com/articles/heroku-ci-parallel-test-runs
{
"addons": [
"heroku-postgresql:in-dyno",
"heroku-redis:in-dyno"
]
}
There is an option in NOD.js that looks interesting, but I do not know how to implement in django terms, they argued we can link to current database when testing.
if (typeof(process.env.DATABASE_URL) !== 'undefined') {
dbUrl = url.parse(process.env.DATABASE_URL);
}
else if (process.env.NODE_ENV === 'test') {
dbUrl = url.parse('tcp://postgres:[email protected]:5432/test');
}
else {
dbUrl = url.parse('tcp://postgres:[email protected]:5432/db');
}