Skip to content

Commit

Permalink
Database refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
ZEZE1020 committed Jan 12, 2025
1 parent 391731e commit 5a8abe0
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions social_media_api/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,15 +110,11 @@
# settings.py


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': config('DATABASE_NAME'),
'USER': config('DATABASE_USER'),
'PASSWORD': config('DATABASE_PASSWORD'),
'HOST': config('DATABASE_HOST'),
'PORT': config('DATABASE_PORT'),
}
DATABASES = {
'default': dj_database_url.config(
default='postgresql://postgres:postgres@localhost:5432/mysite',
conn_max_age=600
)
}


Expand Down Expand Up @@ -160,6 +156,13 @@
STATIC_URL = 'static/'
STATICFILES_DIRS = [os.path.join(BASE_DIR, 'static')]
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# This production code might break development mode, so we check whether we're in DEBUG mode
if not DEBUG:
# Tell Django to copy static assets into a path called `staticfiles` (this is specific to Render)
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
# Enable the WhiteNoise storage backend, which compresses static files to reduce disk use
# and renames the files with unique names for each version to support long-term caching
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
# Default primary key field type
# https://docs.djangoproject.com/en/5.1/ref/settings/#default-auto-field

Expand Down

0 comments on commit 5a8abe0

Please sign in to comment.