Skip to content

Commit

Permalink
Merge pull request #24 from theShinigami/ruff_cleanup
Browse files Browse the repository at this point in the history
Ruff cleanup
  • Loading branch information
sheenarbw authored Nov 20, 2024
2 parents ee00a41 + 8a73921 commit e904509
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
10 changes: 10 additions & 0 deletions core/settings_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
https://docs.djangoproject.com/en/3.2/ref/settings/
"""

import os
from pathlib import Path

# Build paths inside the project like this: BASE_DIR / 'subdir'.
Expand Down Expand Up @@ -130,3 +131,12 @@
# django.contrib.auth settings
LOGIN_REDIRECT_URL = "/"
LOGOUT_REDIRECT_URL = "/"

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

DB_USER = os.environ.get("DATABASE_USER")
DB_HOST = os.environ.get("DATABASE_HOST")
DB_PASSWORD = os.environ.get("DATABASE_PASSWORD")
DB_NAME = os.environ.get("DATABASE_NAME")
DB_PORT = os.environ.get("DATABASE_PORT", 5432)
17 changes: 8 additions & 9 deletions core/settings_dev.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
from .settings_base import *
import os
from .settings_base import * # noqa: F403
import dj_database_url

SECRET_KEY = "not really a secret"
DEBUG = True

MIDDLEWARE += [
MIDDLEWARE += [ # noqa: F405
"django_browser_reload.middleware.BrowserReloadMiddleware",
]

INSTALLED_APPS += [
INSTALLED_APPS += [ # noqa: F405
"django_browser_reload",
"whitenoise.runserver_nostatic",
]
Expand All @@ -22,11 +21,11 @@
# You can run this database using docker compose.
# Look inside dev_db/README.md for details!!

DB_USER = "pguser"
DB_HOST = "127.0.0.1"
DB_PASSWORD = "password"
DB_NAME = "db"
DB_PORT = 6543
DB_USER = os.environ.get("DATABASE_USER", "pguser") # noqa: F405
DB_HOST = os.environ.get("DATABASE_HOST", "127.0.0.1") # noqa: F405
DB_PASSWORD = os.environ.get("DATABASE_PASSWORD", "password") # noqa: F405
DB_NAME = os.environ.get("DATABASE_NAME", "db") # noqa: F405
DB_PORT = os.environ.get("DATABASE_PORT", 5432) # noqa: F405

DATABASES = {
"default": dj_database_url.config(
Expand Down
17 changes: 3 additions & 14 deletions core/settings_prod.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
from .settings_base import *

import os
from .settings_base import * # noqa: F403
import dj_database_url

ALLOWED_HOSTS = ["localhost", "127.0.0.1", "2025.djangocon.africa"]


# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = os.environ["DJANGO_SECRET"]
SECRET_KEY = os.environ["DJANGO_SECRET"] # noqa: F405

DEBUG = False


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

DB_USER = os.environ.get("DATABASE_USER")
DB_HOST = os.environ.get("DATABASE_HOST")
DB_PASSWORD = os.environ.get("DATABASE_PASSWORD")
DB_NAME = os.environ.get("DATABASE_NAME")
DB_PORT = os.environ.get("DATABASE_PORT", 5432)

DATABASES = {
"default": dj_database_url.config(
default=f"postgres://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
default=f"postgres://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}" # noqa: F405
)
}
2 changes: 1 addition & 1 deletion custom_auth/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from django.shortcuts import render
# from django.shortcuts import render

# Create your views here.

0 comments on commit e904509

Please sign in to comment.