Skip to main content

PyPI - Python Vesion GitHub license GitHub issues

Managed 404 Pages with Redirects

Description

A Wagtail package which will give you ability to automatically log and create of redirects from within Wagtail admin panel.

Features

  • Automatic "404 Not Found" HTTP Error Detection Following the Non-Existent Page Opening
  • Support for Redirects to Wagtail Pages

How It Works

  • Regular Expression → Regular Expression [currently in development]
  • Regular Expression → URL
  • Regular Expression → Wagtail Page
  • URL → URL
  • URL → Wagtail Page

Repository inspired by / based on a fork of:

Both projects were similar (one Model class and fairly uncomplicated Middleware), so the easiest thing was simply to combine them, and work onwards from this base. Below, you can see the classes comparison of those two.

Django Regex Redirects Wagtail Managed 404 (Cjk404)
class Redirect(models.Model) class PageNotFoundEntry(models.Model)
• old_path • url
• new_path • redirect_to_url or redirect_to_page
• regular_expression -
• fallback_redirect -
• nr_times_visited • hits

Testing

Use either Django test runner (python manage.py test cjk404) or pytest.

Dependencies

This package is used for the admin panel itself.

Screenshots

"All Redirects" in the Backend

"All Redirects" in the Backend"

"Edit Redirect" in the Backend

"Edit Redirect" in the Backend"

Usage

Fresh install

  1. Get the app from PyPI: pip install wagtail-cjk404

  2. Add 'cjk404' to the INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'wagtail_modeladmin', # required dependency
    'cjk404'
    ...
]
  1. Add the supplied middleware. You may also want to disable Wagtail's default RedirectMiddleware:
MIDDLEWARE = [
    'cjk404.middleware.PageNotFoundRedirectMiddleware',
    # "wagtail.contrib.redirects.middleware.RedirectMiddleware",
]
  1. Run the migrations:
python manage.py migrate
  1. Visit the Wagtail admin area. You should see any 404s recorded in the application, and you can add redirects to them. You can also add your own redirects, e.g. based on regexp.

Upgrade from the old (dj-apps-cjk404) version

  1. Remove folder apps/cjk404 with all contents
  2. Change 'apps.cjk404' to 'cjk404' in INSTALLED_APPS.
  3. Get the app from PyPI: ```pip install wagtail-cjk404``
  4. You're done!

Development

Utility scripts - testing

Assuming you have Django>=4.0 and Wagtail>=3.0 pip-installed in your virtual environment, you do not need to set up a new Django/Wagtail project to develop/test the app.

After you git clone the repository, use load_tests.py to call boot_django and then to execute the unit tests.

Authors

Github URL

Old URL:

https://github.com/cjkpl/dj-apps-cjk404

New URL:

https://github.com/cjkpl/wagtail-cjk404

Please migrate your local repositories to the new URL by executing:

$ git remote set-url origin https://github.com/cjkpl/wagtail-cjk404

Metadata

Release files for wagtail-cjk404 24.5.1

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

Source distribution (sdist)

Source distribution for wagtail-cjk404 24.5.1
File Size Uploaded Provenance Actions
wagtail_cjk404-24.5.1.tar.gz 677.4 kB Without provenance Details for wagtail_cjk404-24.5.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wagtail-cjk404 24.5.1
File Interpreter ABI Platform Actions
wagtail_cjk404-24.5.1-py2.py3-none-any.whl Python 3, Python 2 none any Details for wagtail_cjk404-24.5.1-py2.py3-none-any.whl

Total release size: 694.7 kB

Release files / wagtail_cjk404-24.5.1.tar.gz

Download URL wagtail_cjk404-24.5.1.tar.gz
Size 677.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1883d4f760b1d7fd90a794eeca3cb595e7ec7249aa0d017fc57302422b373f81
BLAKE2b-256 checksum
How to use checksums
5310cc8cbefc7793b600eff911f0a7f296b479e5b20f2b21d2de9573cf7b02da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Release files / wagtail_cjk404-24.5.1-py2.py3-none-any.whl

Download URL wagtail_cjk404-24.5.1-py2.py3-none-any.whl
Size 17.3 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
4c2ac924c960db0322e0bf83e25532b826b634bb665ef7d998b1ca95824d5207
BLAKE2b-256 checksum
How to use checksums
17da211def7dbf87d35fc29e0a6aa51e88ec2f074d357794d7036bea8238bf26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.0.0 CPython/3.11.6

Security for wagtail-cjk404 24.5.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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