Skip to main content

Django Smart Dynamic Path v1.0.2

Dynamic secret admin URL for Django. Time-based, deterministic, no storage.

Hide your Django admin behind a URL that changes daily/monthly. Only you know the secret phrase to generate the current path.


GitHub release (latest by date) GitHub top language GitHub GitHub stars GitHub forks

PyPI - Downloads PyPI PyPI - Format PyPI Downloads PyPI Downloads PyPI Downloads


What it does

Standard Django admin: /admin/ (always the same)

This package: /admin/a1b2c3d4e5f6g7h8/ (changes automatically)


Disclaimer

By using this software, you agree to the full disclaimer terms.

Summary: Software provided "AS IS" without warranty. You assume all risks.

Full legal disclaimer: See DISCLAIMER.md


Installation

pip install django-smart-dynamic-path

Quick start

1. Add to INSTALLED_APPS

INSTALLED_APPS = [
    'django_smart_dynamic_path',
    'django.contrib.admin',
    # ...
]

2. Replace admin URLs in urls.py

from django.urls import path, include

urlpatterns = [
    path('admin/', include('django_smart_dynamic_path.urls')),
]

3. Generate SECRET_KEY from secret phrase (local)

smart-dynamic-path --secret "your secret phrase" --key-only

Copy the output and set as SECRET_KEY in your .env or settings.py.

4. Configure period (optional, in settings.py)

SECRET_ADMIN_PERIOD = 'day'  # day, month, static

5. Get current admin path (server)

python manage.py get_admin_path --full

⚠️ Important Django limitation

Due to Django's URL compilation mechanism, the admin path is calculated once when the server starts. To apply a new path when the period changes (e.g., next day), you need to restart the server.

Automatic restart with cron

# Add to crontab (restart at midnight)
0 0 * * * systemctl restart gunicorn

This is not a bug, but a Django architectural feature.

Django management commands

Command Output
python manage.py generate_secret_key --secret "phrase" SECRET_KEY and period
python manage.py get_admin_path a1b2c3d4e5f6g7h8
python manage.py get_admin_path --full /a1b2c3d4e5f6g7h8/

Template tag

{% load admin_link %}
<a href="{% secret_admin_link %}">Secret Admin</a>

Python API

from django_smart_dynamic_path import get_admin_path, get_admin_url

path = get_admin_path()      # 'a1b2c3d4e5f6g7h8'
url = get_admin_url()        # 'admin/a1b2c3d4e5f6g7h8/'

How it works

SECRET_KEY = SHA256(secret_phrase)                 # 64 hex chars (256 bits)
ADMIN_PATH = SHA256(SECRET_KEY + date)[:16].hex()  # 32 hex chars (128 bits)
  • Secret phrase → SECRET_KEY (256 bits)
  • SECRET_KEY + current date → admin path (128 bits)
  • Path changes automatically based on period (day/month/hour/static)
  • Same secret phrase always produces same SECRET_KEY
  • Same SECRET_KEY + same date always produces same path

Getting the path locally

git clone https://github.com/smartlegionlab/smart-dynamic-path
cd smart-dynamic-path

python3 -m smart_dynamic_path.cli --secret "my secret phrase"
python3 -m smart_dynamic_path.cli --secret "my secret phrase" --period month --prefix admin --full
python3 -m smart_dynamic_path.cli --secret "my secret phrase" --key-only

Implemented paradigms

1. Pointer‑Based Security

The admin URL is not stored anywhere. It is regenerated on demand from a secret phrase and current time. There is no stored "pointer" — only the ability to compute it.

DOI: 10.5281/zenodo.17204738

2. Local Data Regeneration

The exact admin path is computed locally on the developer's machine using only the secret phrase and date, without accessing the server. The server never knows the secret phrase.

DOI: 10.5281/zenodo.17264327

3. Position‑Candidate‑Hypothesis (PCH)

Among all possible URL paths (2¹²⁸ candidates), only one specific path generated by the secret phrase is valid at any given time. The hypothesis (which path is valid) is verified through the hash function.

DOI: 10.5281/zenodo.17614888

Security

  • No additional secrets — uses only Django's existing SECRET_KEY
  • Secret phrase exists only in memory, never stored
  • 32 hex chars = 2¹²⁸ possible paths (no brute force)
  • Time‑based rotation limits exposure window

License

BSD-3-Clause

Author

Alexander Suvorov @smartlegionlab

Metadata

Release files for django-smart-dynamic-path 1.0.2

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

Source distribution (sdist)

Source distribution for django-smart-dynamic-path 1.0.2
File Size Uploaded
django_smart_dynamic_path-1.0.2.tar.gz 8.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-smart-dynamic-path 1.0.2
File Interpreter ABI Platform
django_smart_dynamic_path-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.6 kB

Release files / django_smart_dynamic_path-1.0.2.tar.gz

Download URL django_smart_dynamic_path-1.0.2.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8825204cf8112c3a6c2105a54e9fa5c6e40770538d9e3cbfe590b79421bfacb4
BLAKE2b-256 checksum
How to use checksums
ade34e8edabea55295dc4e08480a3041c87b3d769226dbbbedaa167d9d8eea56
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release files / django_smart_dynamic_path-1.0.2-py3-none-any.whl

Download URL django_smart_dynamic_path-1.0.2-py3-none-any.whl
Size 8.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9c68d58d6555ea55a237efe9fd2ed191dd3c5ea68857512ec8b29abc94896475
BLAKE2b-256 checksum
How to use checksums
9d842c1da0bdb87992c49e471f5ee4899ef90b1b733e2518bba4cb59d435ffa3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.5

Release history Release notifications | RSS feed

This release

1.0.2 This release

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