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.2.tar.gz
(3.3 kB
view details)
Built Distribution
File details
Details for the file django-onerror-1.0.2.tar.gz
.
File metadata
- Download URL: django-onerror-1.0.2.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/2.7.12+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d9fb31f476d36e43b0a802031f71d3c1b2e2d7b19b9e15525a543e23d2c3564b |
|
MD5 | 57021ccc49469a59cce7406c8116c297 |
|
BLAKE2b-256 | ac352ef62201afc0dd32b61d601115373f5fa4984af2586a93da9c07a788d2df |
Provenance
File details
Details for the file django_onerror-1.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: django_onerror-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.19.8 CPython/2.7.12+
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d1f15643d70e66831a3a38ed5796e39062b209b03f856ebf6607d438b79615c |
|
MD5 | 5f6084e1442a02c7f1db98930edb117d |
|
BLAKE2b-256 | 2f7cead5017730e03b4a38576b58b2c3c129a6ad139b48d688d1ad33f6c1a415 |