Skip to content

Instantly share code, notes, and snippets.

View marksweb's full-sized avatar
Making fantasy a reality

Mark Walker marksweb

Making fantasy a reality
View GitHub Profile

Keybase proof

I hereby claim:

  • I am marksweb on github.
  • I am markwalker (https://keybase.io/markwalker) on keybase.
  • I have a public key ASBR5scDMn5FSCoMk5ovovTddzHzwsn_lnJQ8vs-amP6hgo

To claim this, I am signing this object:

@marksweb
marksweb / sanitize.py
Created June 1, 2023 22:06
Python casting utility
# pylint: disable=inconsistent-return-statements
def sanitize(value, output_type):
"""
Handy wrapper function for individual sanitize functions.
:param value: Input value to be sanitized
:param output_type: Class of required output
:type output_type: bool or int
@marksweb
marksweb / settings.py
Created October 4, 2023 20:32
Single settings example
import os
import re
import sys
from django.db.models import options
import sentry_sdk
from base.utils.sanitize import sanitize
from sentry_sdk.integrations.celery import CeleryIntegration
from sentry_sdk.integrations.django import DjangoIntegration
@marksweb
marksweb / conf.py
Created December 1, 2023 21:56
Using lazy settings in django apps
# myapp/conf.py
from core.settings import Settings
DEFAULTS = {
'TEMP_DIR': '/tmp/'
}
settings = Settings(DEFAULTS)