Django: Heroku Postgres resets uploaded data every idle

My problem seems to be the same as addressed in this page. However, I believe I am using an add-on for my case, specifically the Heroku Postgres. In case it is needed, here is a part of my settings.py:


BASE_DIR = Path(__file__).resolve().parent.parent

SECRET_KEY = env.str("SECRET_KEY")

DEBUG = env.bool("DEBUG", default=False)

ALLOWED_HOSTS = \[".herokuapp.com", "localhost", "127.0.0.1"\]

CSRF_TRUSTED_ORIGINS = \['https://8000-abcdarl-hivforecastingd-4p274ahpjtp.ws-us67.gitpod.io'\]


# Database

DATABASES = {
'default': env.dj_db_url("DATABASE_URL")
}

# Static files (CSS, JavaScript, Images)

# https://docs.djangoproject.com/en/4.1/howto/static-files/

STATIC_URL = 'static/'
STATICFILES_DIRS = \[BASE_DIR / 'static'\]
STATIC_ROOT = BASE_DIR / 'staticfiles'
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
MEDIA_URL = '/media/'

# Default primary key field type

# https://docs.djangoproject.com/en/4.1/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'

Here is a screenshot of my config variables: Screenshot of my config variables

In my Django admin, I could still see all my uploaded files, but I could only download the recent ones and it would say not found in the previous ones. This is my first time deploying an application and using Heroku, so I am still new with every process involved. Thank you in advance. I don't know what to try as I am still new with everything, but I kept on researching how to handle it and I couldn't find any solution.

Back to Top