Skip to content

Commit

Permalink
Upgrade Django to 4.2.5 and postgres:16
Browse files Browse the repository at this point in the history
  • Loading branch information
jbernal0019 committed Sep 20, 2023
1 parent 5ffacfd commit fd81ad0
Show file tree
Hide file tree
Showing 13 changed files with 47 additions and 52 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# docker build --build-arg http_proxy=${PROXY} --build-arg ENVIRONMENT=local -t local/chris_store:dev .
#

FROM fnndsc/ubuntu-python3:ubuntu20.04-python3.8.5
FROM fnndsc/ubuntu-python3:ubuntu20.04-python3.8.10
MAINTAINER fnndsc "dev@babymri.org"

# Pass a UID on build command line (see above) to set internal UID
Expand Down
2 changes: 1 addition & 1 deletion docker-compose_dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ services:
role: "Development server"

chris_store_dev_db:
image: postgres:13
image: postgres:16
volumes:
- chris_store_dev_db_data:/var/lib/postgresql/data
environment:
Expand Down
4 changes: 2 additions & 2 deletions make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ if [[ "$1" == 'up' ]]; then

title -d 1 "Pulling core containers where needed..."
printf "${LightCyan}%40s${Green}%-40s${Yellow}\n" \
"docker pull" " postgres:13" | ./boxes.sh
docker pull postgres:13 | ./boxes.sh
"docker pull" " postgres:16" | ./boxes.sh
docker pull postgres:16 | ./boxes.sh
echo "" | ./boxes.sh
windowBottom

Expand Down
12 changes: 6 additions & 6 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Django==4.0
django-filter==22.1
djangorestframework==3.13.1
django-cors-headers==3.13.0
psycopg2==2.9.3
mod-wsgi==4.9.3
Django==4.2.5
django-filter==23.3
djangorestframework==3.14.0
django-cors-headers==4.2.0
psycopg[binary,pool]
mod-wsgi==4.9.4
environs==9.5.0
six==1.16.0
12 changes: 6 additions & 6 deletions requirements/local.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Local development dependencies go here
-r base.txt
django-debug-toolbar==3.6.0
django-extensions==3.2.0
django-debug-toolbar==4.2.0
django-extensions==3.2.3
collection-json==0.1.1
coverage==6.4.4
pylint==2.15.0
flake8==5.0.4
isort==5.10.1
coverage==7.3.1
pylint==2.17.5
flake8==6.1.0
isort==5.12.0
4 changes: 2 additions & 2 deletions store_backend/config/asgi.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
ASGI config for mysite project.
ASGI config for store_backend project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/asgi/
https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/
"""

import os, sys
Expand Down
23 changes: 10 additions & 13 deletions store_backend/config/settings/common.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# -*- coding: utf-8 -*-
"""
Django settings for mysite project.
Django settings for store_backend project.
Generated by 'django-admin startproject' using Django 4.0.
Generated by 'django-admin startproject' using Django 4.2.5.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/topics/settings/
https://docs.djangoproject.com/en/4.2/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/
https://docs.djangoproject.com/en/4.2/ref/settings/
"""

from pathlib import Path
Expand Down Expand Up @@ -95,7 +95,7 @@


# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases

DATABASES = {
'default': {
Expand All @@ -105,7 +105,7 @@


# Password validation
# https://docs.djangoproject.com/en/4.0/ref/settings/#auth-password-validators
# https://docs.djangoproject.com/en/4.2/ref/settings/#auth-password-validators

AUTH_PASSWORD_VALIDATORS = [
{
Expand All @@ -124,26 +124,23 @@


# Internationalization
# https://docs.djangoproject.com/en/4.0/topics/i18n/
# https://docs.djangoproject.com/en/4.2/topics/i18n/

LANGUAGE_CODE = 'en-us'

TIME_ZONE = 'America/New_York'

USE_I18N = True

USE_L10N = True

USE_TZ = True


# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/

STATIC_URL = '/static/'
# https://docs.djangoproject.com/en/4.2/howto/static-files/

STATIC_URL = 'static/'

# Default primary key field type
# https://docs.djangoproject.com/en/4.0/ref/settings/#default-auto-field
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field

DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
15 changes: 7 additions & 8 deletions store_backend/config/settings/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,19 @@
from .common import * # noqa

# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/

# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'w1kxu^l=@pnsf!5piqz6!!5kdcdpo79y6jebbp+2244yjm*#+k'

# Hosts/domain names that are valid for this site
# See https://docs.djangoproject.com/en/4.0/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']
SECRET_KEY = 'django-insecure-tvtw1#&s4i9pxosr^2rnwdh0o1-ka-l+u6(@t+c)#864((*3$4'

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True

# See https://docs.djangoproject.com/en/4.2/ref/settings/#allowed-hosts
ALLOWED_HOSTS = ['*']

# LOGGING CONFIGURATION
# See https://docs.djangoproject.com/en/4.0/topics/logging/ for
# See https://docs.djangoproject.com/en/4.2/topics/logging/ for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
Expand Down Expand Up @@ -68,7 +67,7 @@


# Database
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES['default']['NAME'] = 'chris_store_dev'
DATABASES['default']['USER'] = 'chris'
DATABASES['default']['PASSWORD'] = 'Chris1234'
Expand Down
8 changes: 3 additions & 5 deletions store_backend/config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,20 @@ def get_secret(setting, secret_type=env):

# SECRET CONFIGURATION
# ------------------------------------------------------------------------------
# See: https://docs.djangoproject.com/en/4.0/ref/settings/#secret-key
# Raises ImproperlyConfigured exception if DJANGO_SECRET_KEY not in os.environ
# See: https://docs.djangoproject.com/en/4.2/ref/settings/#secret-key
SECRET_KEY = get_secret('DJANGO_SECRET_KEY')


# SITE CONFIGURATION
# ------------------------------------------------------------------------------
# Hosts/domain names that are valid for this site
# See https://docs.djangoproject.com/en/4.0/ref/settings/#allowed-hosts
# See https://docs.djangoproject.com/en/4.2/ref/settings/#allowed-hosts
ALLOWED_HOSTS = get_secret('DJANGO_ALLOWED_HOSTS', env.list)
# END SITE CONFIGURATION


# DATABASE CONFIGURATION
# ------------------------------------------------------------------------------
# Raises ImproperlyConfigured exception if DATABASE_URL not in os.environ
DATABASES['default']['NAME'] = get_secret('POSTGRES_DB')
DATABASES['default']['USER'] = get_secret('POSTGRES_USER')
DATABASES['default']['PASSWORD'] = get_secret('POSTGRES_PASSWORD')
Expand All @@ -51,7 +49,7 @@ def get_secret(setting, secret_type=env):


# LOGGING CONFIGURATION
# See https://docs.djangoproject.com/en/4.0/topics/logging/ for
# See https://docs.djangoproject.com/en/4.2/topics/logging/ for
# more details on how to customize your logging configuration.
ADMINS = [('FNNDSC Developers', 'dev@babymri.org')]
LOGGING = {
Expand Down
5 changes: 3 additions & 2 deletions store_backend/config/urls.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
"""mysite URL Configuration
"""
URL configuration for store_backend project.
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/4.0/topics/http/urls/
https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
Expand Down
4 changes: 2 additions & 2 deletions store_backend/config/wsgi.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
"""
WSGI config for mysite project.
WSGI config for store_backend project.
It exposes the WSGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/4.0/howto/deployment/wsgi/
https://docs.djangoproject.com/en/4.2/howto/deployment/wsgi/
"""

import os, sys
Expand Down
6 changes: 3 additions & 3 deletions store_backend/migratedb.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import time
import sys
import psycopg2
import psycopg
from argparse import ArgumentParser

# django needs to be loaded
Expand Down Expand Up @@ -31,8 +31,8 @@
db = None
while max_tries > 0 and db is None:
try:
db = psycopg2.connect(host=host, user=args.user, password=args.password,
dbname=args.database)
db = psycopg.connect(host=host, user=args.user, password=args.password,
dbname=args.database)
except Exception:
time.sleep(5)
max_tries -= 1
Expand Down
2 changes: 1 addition & 1 deletion swarm/prod/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ services:
role: "Production server using Apache's mod_wsgi"

chris_store_db:
image: postgres:13
image: postgres:16
volumes:
- chris_store_db_data:/var/lib/postgresql/data
env_file:
Expand Down

0 comments on commit fd81ad0

Please sign in to comment.