Django ``window.onerror`` Report
Project description
Django window.onerror Report
Installation
pip install django-onerror
Urls.py
urlpatterns = [ url(r'^e/', include('django_onerror.urls', namespace='django_onerror')), ]
or:
urlpatterns = [ url(r'^report', err_views.err_report, name='err_report'), ]
Settings.py
INSTALLED_APPS = ( ... 'django_onerror', ... )
FrontEnd
<script> window.onerror = function(errorMessage, scriptURI, lineNo, columnNo, error) { // 构建错误对象 var errorObj = { href: window.location.href, ua: window.navigator.userAgent, lineNo: lineNo || 0, columnNo: columnNo || 0, scriptURI: scriptURI || null, errorMessage: errorMessage || null, stack: error && error.stack ? error.stack : null }; // 构建Http请求 if (XMLHttpRequest) { var xhr = new XMLHttpRequest(); xhr.open('post', '/e/report', true); xhr.setRequestHeader('Content-Type', 'application/json'); // 设置请求头 xhr.send(JSON.stringify(errorObj)); // 发送参数 } } </script>
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-onerror-1.0.9.tar.gz
(3.9 kB
view details)
Built Distribution
File details
Details for the file django-onerror-1.0.9.tar.gz
.
File metadata
- Download URL: django-onerror-1.0.9.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e722a637d30190123532a80424958d6405ceba3ca0cba735dff4dc39119342fc |
|
MD5 | 55091aa7b98717454dfe450757733831 |
|
BLAKE2b-256 | fe2fc0fc41ba74cb5f40db35ae675ecd68306812aed13cb71da96a823a2b3dee |
File details
Details for the file django_onerror-1.0.9-py2.py3-none-any.whl
.
File metadata
- Download URL: django_onerror-1.0.9-py2.py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/18.5 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/2.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 52c6f71b19fb561909425bc5a160c9c325891f40916397b5c06dfb135af23be3 |
|
MD5 | 7ec67a1a0c30935c587c16f2d5dff8b1 |
|
BLAKE2b-256 | bef40131da62dbc2938f2fcf54e07716d6ba76c1a8b13a43c0252e653dfa4dde |