0๐
A simple solution that worked for me is to explicitly specify the test database name in settings.py
, e.g.,
DATABASES = {
'default': {
...
'TEST': {
# Avoid naming it the same as your original database name.
# Otherwise, it will be used while testing (and even may get deleted).
'NAME': 'name_of_your_choice',
},
},
...
}
If you are using multiple databases, you may need to do it for all of them.
๐คDipen Dadhaniya
-1๐
for using the PostgreSQL database on your Django project you can configure your database the same.
DATABASES = {
'default': {
"ENGINE": "django.db.backends.postgresql_psycopg2",
"NAME": 'Table_name',
"USER": 'user_name',
"PASSWORD": 'password',
"HOST": 'localhost', # or 127.0.0.1
"PORT": '5432', #5432 is the default PostgreSQL port if you change it must change this port
}
}
and for setting multiple databases on your Django project, you can see this page and use it.
- Django makemigrations and migrate on heroku server don't create tables
- Pass list of fields to QuerySet.values( )
Source:stackexchange.com