![PyPI - Python Vesion](https://img.shields.io/pypi/pyversions/wagtail-cjk404)
[![GitHub license](https://img.shields.io/github/license/cjkpl/wagtail-cjk404)](https://github.com/cjkpl/wagtail-cjk404/blob/main/LICENSE)
[![GitHub issues](https://img.shields.io/github/issues/cjkpl/wagtail-cjk404)](https://github.com/cjkpl/wagtail-cjk404/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](https://docs.wagtail.io/en/stable/reference/pages/index.html)
### 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:
- [wagtail_managed404](https://wagtail-managed404.readthedocs.io/) - abandoned in 2018
- [django-regex-redirects](https://github.com/maykinmedia/django-regex-redirects).
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
- wagtail.contrib.modeladmin (https://docs.wagtail.io/en/stable/reference/contrib/modeladmin/index.html)
This package is used for the admin panel itself.
## Screenshots
#### "All Redirects" in the Backend
!["All Redirects" in the Backend"](https://user-images.githubusercontent.com/34211633/236237989-3c396246-53ee-4d57-91cf-31b9333fb47a.png)
#### "Edit Redirect" in the Backend
!["Edit Redirect" in the Backend"](https://user-images.githubusercontent.com/34211633/236238437-33c856ca-592b-4235-9d15-5c1953d0ade3.png)
### Usage
#### Fresh install
1. Get the app from PyPI:
```pip install wagtail-cjk404```
2. Add 'cjk404' to the INSTALLED_APPS:
```python
INSTALLED_APPS = [
...
'wagtail_modeladmin', # required dependency
'cjk404'
...
]
```
3. Add the supplied middleware. You may also want to disable Wagtail's default ```RedirectMiddleware```:
```python
MIDDLEWARE = [
'cjk404.middleware.PageNotFoundRedirectMiddleware',
# "wagtail.contrib.redirects.middleware.RedirectMiddleware",
]
```
4. Run the migrations:
```python
python manage.py migrate
```
5. 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
- [Grzegorz Król](https://github.com/cjkpl)
- [Filip Woźniak](https://github.com/FilipWozniak)
## Github URL
### Old URL:
[https://github.com/cjkpl/dj-apps-cjk404](https://github.com/cjkpl/dj-apps-cjk404)
### New URL:
[https://github.com/cjkpl/wagtail-cjk404](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
```
Raw data
{
"_id": null,
"home_page": "https://github.com/cjkpl/wagtail-cjk404",
"name": "wagtail-cjk404",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "wagtail, django, cms",
"author": "Grzegorz Krol, Filip Wozniak",
"author_email": "Grzegorz Krol <gk@cjk.pl>",
"download_url": "https://files.pythonhosted.org/packages/53/10/cc8cbefc7793b600eff911f0a7f296b479e5b20f2b21d2de9573cf7b02da/wagtail_cjk404-24.5.1.tar.gz",
"platform": null,
"description": "![PyPI - Python Vesion](https://img.shields.io/pypi/pyversions/wagtail-cjk404)\n[![GitHub license](https://img.shields.io/github/license/cjkpl/wagtail-cjk404)](https://github.com/cjkpl/wagtail-cjk404/blob/main/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues/cjkpl/wagtail-cjk404)](https://github.com/cjkpl/wagtail-cjk404/issues) \n\n\n# Managed 404 Pages with Redirects\n\n## Description\n\nA Wagtail package which will give you ability to automatically log and create of redirects from within Wagtail admin panel. \n\n\n### Features\n\n- Automatic \"404 Not Found\" HTTP Error Detection Following the Non-Existent Page Opening \n- Support for Redirects to [Wagtail Pages](https://docs.wagtail.io/en/stable/reference/pages/index.html)\n\n### How It Works \n\n- `Regular Expression \u2192 Regular Expression` [currently in development]\n- `Regular Expression \u2192 URL`\n- `Regular Expression \u2192 Wagtail Page`\n- `URL \u2192 URL`\n- `URL \u2192 Wagtail Page`\n\n### Repository inspired by / based on a fork of:\n- [wagtail_managed404](https://wagtail-managed404.readthedocs.io/) - abandoned in 2018\n- [django-regex-redirects](https://github.com/maykinmedia/django-regex-redirects).\n\nBoth 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. \nBelow, you can see the classes comparison of those two.\n\n| **Django Regex Redirects** | **Wagtail Managed 404 (Cjk404)** |\n|:---------------------------:|:----------------------------:|\n| `class Redirect(models.Model)` | `class PageNotFoundEntry(models.Model)` |\n| \u2022 `old_path` | \u2022 `url` |\n| \u2022 `new_path` | \u2022 `redirect_to_url` or `redirect_to_page` |\n| \u2022 `regular_expression` | - |\n| \u2022 `fallback_redirect` | - |\n| \u2022 `nr_times_visited` | \u2022 `hits` |\n\n### Testing ###\nUse either Django test runner (`python manage.py test cjk404`) or pytest.\n\n### Dependencies\n- wagtail.contrib.modeladmin (https://docs.wagtail.io/en/stable/reference/contrib/modeladmin/index.html)\n\nThis package is used for the admin panel itself.\n\n## Screenshots\n\n#### \"All Redirects\" in the Backend\n![\"All Redirects\" in the Backend\"](https://user-images.githubusercontent.com/34211633/236237989-3c396246-53ee-4d57-91cf-31b9333fb47a.png)\n\n\n#### \"Edit Redirect\" in the Backend \n![\"Edit Redirect\" in the Backend\"](https://user-images.githubusercontent.com/34211633/236238437-33c856ca-592b-4235-9d15-5c1953d0ade3.png)\n\n\n### Usage\n\n#### Fresh install\n\n1. Get the app from PyPI:\n```pip install wagtail-cjk404```\n\n\n2. Add 'cjk404' to the INSTALLED_APPS:\n\n```python\nINSTALLED_APPS = [\n ...\n 'wagtail_modeladmin', # required dependency\n 'cjk404'\n ...\n]\n```\n\n3. Add the supplied middleware. You may also want to disable Wagtail's default ```RedirectMiddleware```:\n\n```python\nMIDDLEWARE = [\n 'cjk404.middleware.PageNotFoundRedirectMiddleware',\n # \"wagtail.contrib.redirects.middleware.RedirectMiddleware\",\n]\n```\n\n4. Run the migrations:\n```python\npython manage.py migrate\n```\n\n5. 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.\n\n#### Upgrade from the old (dj-apps-cjk404) version\n\n1. Remove folder ```apps/cjk404``` with all contents\n2. Change 'apps.cjk404' to 'cjk404' in INSTALLED_APPS.\n3. Get the app from PyPI: ```pip install wagtail-cjk404``\n4. You're done!\n\n## Development\n\n### Utility scripts - testing\nAssuming 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.\n\nAfter you ```git clone``` the repository, use ```load_tests.py``` to call ```boot_django``` and then to execute the unit tests.\n\n## Authors\n\n- [Grzegorz Kr\u00f3l](https://github.com/cjkpl)\n- [Filip Wo\u017aniak](https://github.com/FilipWozniak)\n\n## Github URL\n\n### Old URL:\n[https://github.com/cjkpl/dj-apps-cjk404](https://github.com/cjkpl/dj-apps-cjk404)\n\n### New URL:\n[https://github.com/cjkpl/wagtail-cjk404](https://github.com/cjkpl/wagtail-cjk404)\n\nPlease migrate your local repositories to the new URL by executing:\n```\n$ git remote set-url origin https://github.com/cjkpl/wagtail-cjk404\n```\n",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "404 handler for Wagtail, with regexp support",
"version": "24.5.1",
"project_urls": {
"Homepage": "https://github.com/cjkpl/wagtail-cjk404",
"Repository": "https://github.com/cjkpl/wagtail-cjk404"
},
"split_keywords": [
"wagtail",
" django",
" cms"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "17da211def7dbf87d35fc29e0a6aa51e88ec2f074d357794d7036bea8238bf26",
"md5": "5a0626e6370674e872ec56fec587627e",
"sha256": "4c2ac924c960db0322e0bf83e25532b826b634bb665ef7d998b1ca95824d5207"
},
"downloads": -1,
"filename": "wagtail_cjk404-24.5.1-py2.py3-none-any.whl",
"has_sig": false,
"md5_digest": "5a0626e6370674e872ec56fec587627e",
"packagetype": "bdist_wheel",
"python_version": "py2.py3",
"requires_python": ">=3.9",
"size": 17263,
"upload_time": "2024-05-03T08:27:43",
"upload_time_iso_8601": "2024-05-03T08:27:43.076966Z",
"url": "https://files.pythonhosted.org/packages/17/da/211def7dbf87d35fc29e0a6aa51e88ec2f074d357794d7036bea8238bf26/wagtail_cjk404-24.5.1-py2.py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "5310cc8cbefc7793b600eff911f0a7f296b479e5b20f2b21d2de9573cf7b02da",
"md5": "a2f7460c2ad3ebbe6309c12e6c2ddf00",
"sha256": "1883d4f760b1d7fd90a794eeca3cb595e7ec7249aa0d017fc57302422b373f81"
},
"downloads": -1,
"filename": "wagtail_cjk404-24.5.1.tar.gz",
"has_sig": false,
"md5_digest": "a2f7460c2ad3ebbe6309c12e6c2ddf00",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 677437,
"upload_time": "2024-05-03T08:27:46",
"upload_time_iso_8601": "2024-05-03T08:27:46.859700Z",
"url": "https://files.pythonhosted.org/packages/53/10/cc8cbefc7793b600eff911f0a7f296b479e5b20f2b21d2de9573cf7b02da/wagtail_cjk404-24.5.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-03 08:27:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "cjkpl",
"github_project": "wagtail-cjk404",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "wagtail-cjk404"
}