Django admin URL introspection. Inspect, search, and understand your project's URL routing—directly from the admin.
https://yassi.github.io/dj-urls-panel/
- URL Visualization: View all Django URL patterns in an organized, searchable interface
- URL Testing Interface: Swagger-like interface for testing URLs with:
- HTTP method selection (GET, POST, PUT, PATCH, DELETE, etc.)
- Dynamic URL parameter input
- Header specification
- Authentication support (Bearer, Token, Basic Auth, Session)
- Request body editor with JSON formatting
- Live cURL command generation with copy functionality
- Real-time response display with headers and body
- DRF Integration: Automatic detection and visualization of Django REST Framework serializers
- Security Features:
- Configurable SSRF protection with default blocklist for internal IPs
- Optional host whitelisting for production environments
- Ability to disable testing interface entirely
- Search & Filter: Search URLs by pattern, name, or view function
- Namespace Support: Filter and organize URLs by namespace
dj-urls-panel/
├── dj_urls_panel/ # Main package
│ ├── templates/ # Django templates
│ ├── views.py # Django views
│ └── urls.py # URL patterns
├── example_project/ # Example Django project
├── tests/ # Test suite
├── images/ # Screenshots for README
└── requirements.txt # Development dependencies
- Python 3.9+
- Django 4.2+
Seamlessly integrated into your Django admin interface. A new section for dj-urls-panel will appear in the same places where your models appear.
NOTE: This application does not actually introduce any model or migrations.
Browse all URLs in your Django project with detailed information about patterns, views, and namespaces.
View detailed information about each URL and test it directly from the admin interface.
Test GET requests with dynamic URL parameters, headers, and authentication.
Test PATCH/POST/PUT requests with request body editor and see responses in real-time.
Automatic detection and visualization of Django REST Framework serializers with field details.
View URL metadata and get code examples for using URLs in your Django views.
pip install dj-urls-panelAdd dj_urls_panel to your INSTALLED_APPS:
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'dj_urls_panel', # Add this line
# ... your other apps
]Add custom configuration to your Django settings:
# Optional: Configure dj_urls_panel
DJ_URLS_PANEL_SETTINGS = {
# Exclude specific URL patterns from the panel
'EXCLUDE_URLS': [
r'^admin/', # Exclude admin URLs
r'^__debug__/', # Exclude debug toolbar
],
# Use a custom URLconf instead of ROOT_URLCONF
'URL_CONFIG': None, # e.g., 'myproject.api_urls'
# Enable/disable URL testing interface (recommended: False in production)
'ENABLE_TESTING': True,
# Whitelist hosts for URL testing (SSRF protection)
# None = default blocklist only (blocks localhost, private IPs)
# List = only allow specified hosts
'ALLOWED_HOSTS': None, # e.g., ['example.com', 'api.example.com']
}Security Recommendations:
For production environments, we recommend:
DJ_URLS_PANEL_SETTINGS = {
'ENABLE_TESTING': False, # Disable testing interface
# OR if you need testing in production:
'ALLOWED_HOSTS': ['yourdomain.com'], # Whitelist only your domains
}Add the Panel URLs to your main urls.py:
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/dj-urls-panel/', include('dj_urls_panel.urls')), # Add this line
path('admin/', admin.site.urls),
]python manage.py migrate
python manage.py createsuperuser # If you don't have an admin user-
Start your Django development server:
python manage.py runserver
-
Navigate to the Django admin at
http://127.0.0.1:8000/admin/ -
Look for the "DJ URLS PANEL" section in the admin interface
This project is licensed under the MIT License. See the LICENSE file for details.
If you want to contribute to this project or set it up for local development:
- Python 3.9 or higher
- Redis server running locally
- Git
- Autoconf
- Docker
It is reccommended that you use docker since it will automate much of dev env setup
git clone https://github.com/yassi/dj-urls-panel.git
cd dj-urls-panelpython -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e . # install dj-urls-panel package locally
pip intall -r requirements.txt # install all dev requirements
# Alternatively
make install # this will also do the above in one single commandmake docker_up # bring up all services (redis, memached) and dev environment container
make docker_shell # open up a shell in the docker conatinerThe repository includes an example Django project for development and testing
cd example_project
python manage.py migrate
python manage.py createsuperuserAdd any custom management commands for populating test data if needed.
python manage.py runserverVisit http://127.0.0.1:8000/admin/ to access the Django admin with Dj Urls Panel.
The project includes a comprehensive test suite. You can run them by using make or by invoking pytest directly:
# build and install all dev dependencies and run all tests inside of docker container
make test_docker
# Test without the docker on your host machine.
# note that testing always requires a redis and memcached service to be up.
# these are mostly easily brought up using docker
make test_local







