#Staging and Production in the same database? (heroku)

5 messages · Page 1 of 1 (latest)

robust hornet
#

Hi, I have a technical question. I am using heroku for a personal project, and I have a staging Dyno with a dedicated database.

This means I am paying for it, and I use it mostly to check what i do does not break the site and works every so often.

Now that heroku allows officially to plug two environments in one database, would it be possible to have both in one, without sharing the information?

The last part is the one I do not want to get wrong 🙂

spiral silo
#

I know nothing about heroku, but I do have this in my base_settings.py (and I bet you have something similar) ```py
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"HOST": os.environ.get("PGHOST", "localhost"),
"NAME": "bridge",
"PASSWORD": os.environ.get("PGPASS", "postgres"),
"USER": os.environ.get("PGUSER", "postgres"),
},
}

Presumably, you could override the `NAME`, or really any of those bits, in your debug settings.  In fact, I think this is what the test framework does: creates an entirely separate database for testing
#

OH NOES I EXPOSED MY TOP-SECRET POSTGRES PASSWORD

🤣

robust hornet
#

Hey. Thanks. I was wondering if one of those changes would prevent data leakages.

spiral silo
#

sure, if staging uses one database, and prod uses a different one, and if you're using postgres, they'll be quite separate.