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 = { lineNo: lineNo || null, columnNo: columnNo || null, 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.1.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file django-onerror-1.0.1.tar.gz
.
File metadata
- Download URL: django-onerror-1.0.1.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5dba9d4512261961ff93b432f3e541a9fad5953d01fe8e5a8e5b2c009324246b |
|
MD5 | df087a4e1898658fabb0f4db8e980434 |
|
BLAKE2b-256 | 6e4d33731a609848e0397f21f4d6a2586425327b3378977981318e3f39cb4408 |
File details
Details for the file django_onerror-1.0.1-py2.py3-none-any.whl
.
File metadata
- Download URL: django_onerror-1.0.1-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d195b38ff0300b77374069d8b939a60508b46aebc0f426ea9849e8208651951 |
|
MD5 | d68decf9b49902516b71e0630f26bbee |
|
BLAKE2b-256 | bc391fa072bedd80aef22824f47e59b5e79c9cee5e3b399be3f79a454be42cf3 |