NAS
NAS

Reputation: 218

django heroku deployment postgres config

this is my first time deploying a Django app to Heroku I followed the the Django Heroku documentation

the app is deployed successfully but when I open the app I got this error :

relation "products_category" does not exist
LINE 1: ...ory"."image", "products_category"."catogory" FROM "products_...

this is the changes I did to my settings.py after reading the documentation :

import django_heroku
django_heroku.settings(locals())

the database configuration is still running with sqlite3:

DATABASES = {
'default': {
    'ENGINE': 'django.db.backends.sqlite3',
    'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
   }
  }

so what do I need to change in my setting to deploy my apps properly ?

Upvotes: 0

Views: 95

Answers (2)

bazzuk123
bazzuk123

Reputation: 191

first of all, in your dashboard, Heroku app go to settings and get rid of this DISABLE_COLLECTSTATIC conf.

in your settings.py add

STATIC_ROOT  = BASE_DIR / 'staticfiles'

create a directory called staticfiles, and add smth to it (eg. tmp.txt) just to make sure that git add . will include this directory. Push everything to Heroku and then use these commands:

heroku run python manage.py makemigrations

heroku run python manage.py migrate

Upvotes: 1

bazzuk123
bazzuk123

Reputation: 191

try

heroku run python manage.py makemigrations

and then

heroku run python manage.py migrate

Upvotes: 0

Related Questions