Skip to main content

djinntoux 🐧

Generic reusable bits for Django projects

Disclaimer

This package is only intended for my own personal use, install at your own risk

Rebuild

Assumes twine is installed and an API token is stored in a .pypirc file:

rm -rfv dist/ && python -m build && twine upload --verbose dist/*

Installation

pip install djinntoux

Usage

Environment Variables

The following are expected to be set in your environment, a .env file, or a .envrc file:

DATABASE_URL            # no default
DJANGO_SECRET_KEY       # no default
DJANGO_DEBUG            # defaults to false
DJANGO_ENV_NAME         # defaults to prod
DJANGO_ADMIN_HEADER_BG  # defaults to red

settings2

In your own project settings, use like so:

from djinntoux.dproj.settings_reuse import *  # noqa

...

INSTALLED_APPS = BASE_APPS + []

This reusable settings module expects DJANGO_SECRET_KEY to be set in your environment. For example, if you are just running your project locally, you could use an .envrc file for your development environment ...

...
export 'DJANGO_SECRET_KEY'='django-insecure-321-do-not-use-this!!!'
...

... and then use a systemd unit file for a mock production environment ...

...
[Service]
Environment='DJANGO_SECRET_KEY'='django-insecure-321-do-not-use-this!!!'
...

urls2

In your project root URLconf, use like so:

urlpatterns = [
    path('', include('djinntoux.dproj.urls_reuse')),
    ...
]

Abstract Models

https://github.com/venteto/djinntoux/blob/main/djinntoux/abstract/ab_mod.py

As an example in a models.py file:

from djinntoux.abstract.ab_mod import EditLink, Timestamps, UUIDpk7

...

class Account(Timestamps, EditLink):

EditLink

Set ADMIN_PATH in project settings (do not add a leading slash), e.g. to keep the Django default path without using an environment variable:

ADMIN_PATH = 'admin/'

Then in templates you can use like so:

<a target="_blank" href="{{ obj.get_edit_path }}">Edit</a>

Custom Users App

https://github.com/venteto/djinntoux/tree/main/djinntoux/dapp_users

In project settings add djinntoux.dapp_users to INSTALLED_APPS and set AUTH_USER_MODEL = 'zy_users.User'

Renames

https://github.com/venteto/djinntoux/blob/main/djinntoux/dproj/rename.py

In project settings make sure INSTALLED_APPS reflects something akin to this:

    'djinntoux.dproj.rename.ContribAuth',   # replaces 'django.contrib.auth',
    'djinntoux.dproj.rename.ContribSites',  # replaces 'django.contrib.sites',

Scraping

https://github.com/venteto/djinntoux/blob/main/djinntoux/utils/scrape.py

from djinntoux.utils.scrape import get_host_and_title

Then use like so:

    def save(self, *args, **kwargs):
        if not self.link_title:
            self.link_title = get_host_and_title(self)[1]
        super(Link, self).save(*args, **kwargs)

TODO (Includes, But Not Limited To)

  • static files? or just link to a pseudo-CDN in base template?
    • compressor?
  • robots.txt view
  • error views
  • favicon view
  • aggregation util
  • abstract view and admin classes

See Also

https://github.com/venteto/djinntoux/blob/main/READMORE.md

Release files for djinntoux 0.0.8.19

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for djinntoux 0.0.8.19
File Size Uploaded
djinntoux-0.0.8.19.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for djinntoux 0.0.8.19
File Interpreter ABI Platform
djinntoux-0.0.8.19-py3-none-any.whl Python 3 none any Details

Total release size: 16.1 kB

Release files / djinntoux-0.0.8.19.tar.gz

Download URL djinntoux-0.0.8.19.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1b1af8a85d9a1a61e605ae6f42c74327f3459f4cfa7f52a87269c809d55f20cf
BLAKE2b-256 checksum
How to use checksums
5eb2155588c3c4e990211bfaa79fde1e4896bb67ae8c19af129bcdb0529338fc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release files / djinntoux-0.0.8.19-py3-none-any.whl

Download URL djinntoux-0.0.8.19-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
311e4a3cd7db2bf578d8c1278e255356f6fb154a9b15d4a3faf8851273ae4b98
BLAKE2b-256 checksum
How to use checksums
6f3df1822afde81c3cddd5d6c6ac19d79c9441aebab23e266fec026f797d12d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.0.8.19 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page