Skip to content

Commit

Permalink
Remove unneeded django components b/c only using ORM
Browse files Browse the repository at this point in the history
  • Loading branch information
aloftus23 committed Nov 14, 2024
1 parent 976db4a commit b503562
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 83 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/backend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ jobs:
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}

deploy_integration:
needs: [build_worker, lint, test, test_worker]
needs: [build_worker, test_worker]
runs-on: ubuntu-latest
environment: integration
concurrency: '1'
Expand Down
4 changes: 4 additions & 0 deletions backend/env.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ staging-cd:
COGNITO_URL: https://cognito-idp.us-east-1.amazonaws.com
BACKEND_DOMAIN: https://api.staging-cd.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-east-1
DJANGO_KEY: ${ssm:/crossfeed/staging/DJANGO_KEY}
DB_DIALECT: postgres
DB_PORT: 5432
DB_HOST: ${ssm:/crossfeed/staging/DATABASE_HOST}
Expand Down Expand Up @@ -91,6 +92,7 @@ integration:
COGNITO_URL: https://cognito-idp.us-east-1.amazonaws.com
BACKEND_DOMAIN: https://api.integration.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-east-1
DJANGO_KEY: ${ssm:/crossfeed/integration/DJANGO_KEY}
DB_DIALECT: postgres
DB_PORT: 5432
DB_HOST: ${ssm:/crossfeed/integration/DATABASE_HOST}
Expand Down Expand Up @@ -152,6 +154,7 @@ staging:
COGNITO_URL: https://cognito-idp.us-gov-west-1.amazonaws.com
BACKEND_DOMAIN: https://api.staging.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-gov-west-1
DJANGO_KEY: ${ssm:/crossfeed/staging/DJANGO_KEY}
DB_DIALECT: postgres
DB_PORT: 5432
DB_HOST: ${ssm:/crossfeed/staging/DATABASE_HOST}
Expand Down Expand Up @@ -207,6 +210,7 @@ prod:
COGNITO_URL: https://cognito-idp.us-gov-west-1.amazonaws.com
BACKEND_DOMAIN: https://api.crossfeed.cyber.dhs.gov
EMAIL_REGION: us-gov-west-1
DJANGO_KEY: ${ssm:/crossfeed/prod/DJANGO_KEY}
DB_DIALECT: postgres
DB_PORT: 5432
DB_HOST: ${ssm:/crossfeed/prod/DATABASE_HOST}
Expand Down
4 changes: 0 additions & 4 deletions backend/src/xfd_django/xfd_api/admin.py

This file was deleted.

2 changes: 1 addition & 1 deletion backend/src/xfd_django/xfd_api/schema_models/api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
class ApiKey(BaseModel):
"""Pydantic model for the ApiKey model."""

id: UUID
id: str
createdAt: datetime
updatedAt: datetime
lastUsed: Optional[datetime]
Expand Down
4 changes: 0 additions & 4 deletions backend/src/xfd_django/xfd_api/tests.py

This file was deleted.

53 changes: 3 additions & 50 deletions backend/src/xfd_django/xfd_django/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@

# SECURITY WARNING: keep the secret key used in production secret!
# TODO: GET THAT LATER
SECRET_KEY = "django-insecure-255j80npx26z%x0@-7p@(qs9(yvtuuln#xuhxt_x$bbevvxnm!"
SECRET_KEY = os.getenv("DJANGO_KEY")

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

ALLOWED_HOSTS = [
".execute-api.us-east-1.amazonaws.com",
"https://api.staging-cd.crossfeed.cyber.dhs.gov",
"http://localhost:3000",
os.getenv('BACKEND_DOMAIN'),
os.getenv('REACT_APP_API_URL'),
"http://localhost",
]

Expand All @@ -55,45 +55,17 @@
# Application definition

INSTALLED_APPS = [
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"xfd_api.apps.XfdApiConfig",
]

MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

ROOT_URLCONF = "xfd_django.urls"

TEMPLATES = [
{
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]

WSGI_APPLICATION = "xfd_django.wsgi.application"


# Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
Expand All @@ -112,25 +84,6 @@
}
}

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

AUTH_PASSWORD_VALIDATORS = [
{
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]


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

Expand Down
23 changes: 0 additions & 23 deletions backend/src/xfd_django/xfd_django/urls.py

This file was deleted.

1 change: 1 addition & 0 deletions dev.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ PE_FARGATE_TASK_DEFINITION_NAME=pe-staging-worker

PYTHONPATH=src/xfd_django
DJANGO_SETTINGS_MODULE=xfd_django.settings
DJANGO_KEY=CHANGE_ME

0 comments on commit b503562

Please sign in to comment.