react-render-client
Advanced tools
+7
-0
| Changelog | ||
| ========= | ||
| ### 1.3.2 | ||
| Python package bumped to 1.3.2: | ||
| - Add a configurable timeout using the setting `REACT_TIMEOUT` | ||
| *Note:* Python only release. JavaScript package remains at 1.3.1 | ||
| ### 1.3.1 | ||
@@ -5,0 +12,0 @@ |
+2
-2
| Metadata-Version: 1.1 | ||
| Name: react-render-client | ||
| Version: 1.3.1 | ||
| Version: 1.3.2 | ||
| Summary: Render and bundle React components from a Django application | ||
@@ -9,3 +9,3 @@ Home-page: https://github.com/mic159/react-render | ||
| License: MIT | ||
| Download-URL: https://github.com/mic159/react-render/tarball/1.3.1 | ||
| Download-URL: https://github.com/mic159/react-render/tarball/1.3.2 | ||
| Description: Documentation at https://github.com/mic159/react-render | ||
@@ -12,0 +12,0 @@ Keywords: react,reactjs,django,isomorphic,templates |
| Metadata-Version: 1.1 | ||
| Name: react-render-client | ||
| Version: 1.3.1 | ||
| Version: 1.3.2 | ||
| Summary: Render and bundle React components from a Django application | ||
@@ -9,3 +9,3 @@ Home-page: https://github.com/mic159/react-render | ||
| License: MIT | ||
| Download-URL: https://github.com/mic159/react-render/tarball/1.3.1 | ||
| Download-URL: https://github.com/mic159/react-render/tarball/1.3.2 | ||
| Description: Documentation at https://github.com/mic159/react-render | ||
@@ -12,0 +12,0 @@ Keywords: react,reactjs,django,isomorphic,templates |
@@ -18,2 +18,4 @@ CHANGELOG.md | ||
| react_render_client.egg-info/requires.txt | ||
| react_render_client.egg-info/top_level.txt | ||
| react_render_client.egg-info/top_level.txt | ||
| tests/test_app/__init__.py | ||
| tests/test_app/models.py |
| react_render | ||
| tests |
@@ -9,3 +9,3 @@ import os | ||
| def render_component(path_to_source, props=None, to_static_markup=False, json_encoder=None, service_url=None): | ||
| def render_component(path_to_source, props=None, to_static_markup=False, json_encoder=None, service_url=None, timeout=10): | ||
| if not os.path.exists(path_to_source): | ||
@@ -21,3 +21,3 @@ raise ComponentSourceFileNotFound(path_to_source) | ||
| response = requests.post(service_url, | ||
| timeout=10.0, | ||
| timeout=timeout, | ||
| headers={'Content-Type': 'application/json'}, | ||
@@ -24,0 +24,0 @@ data=json_encoder({ |
@@ -16,2 +16,3 @@ from __future__ import absolute_import | ||
| FAIL_SAFE = getattr(settings, 'REACT_FAIL_SAFE', False) | ||
| TIMEOUT = getattr(settings, 'REACT_TIMEOUT', 10) | ||
@@ -41,3 +42,3 @@ log = logging.getLogger('react-render-client') | ||
| def render_component(path_to_source, props=None, to_static_markup=False, json_encoder=None): | ||
| def render_component(path_to_source, props=None, to_static_markup=False, json_encoder=None, timeout=TIMEOUT): | ||
| if not os.path.isabs(path_to_source): | ||
@@ -65,4 +66,11 @@ # If its using the manifest staticfiles storage, to the hashed name. | ||
| try: | ||
| html = render_core(path_to_source, props, to_static_markup, json_encoder, service_url=SERVICE_URL) | ||
| except: | ||
| html = render_core( | ||
| path_to_source, | ||
| props, | ||
| to_static_markup, | ||
| json_encoder, | ||
| service_url=SERVICE_URL, | ||
| timeout=timeout, | ||
| ) | ||
| except Exception: | ||
| if not FAIL_SAFE: | ||
@@ -69,0 +77,0 @@ raise |
+15
-0
@@ -79,2 +79,3 @@ React Render | ||
| renderer. Defaults to `django.core.serializers.json.DjangoJSONEncoder`. | ||
| - `timeout` *optional* - override the service timeout. | ||
@@ -119,3 +120,17 @@ | ||
| Django settings | ||
| ---------------- | ||
| - `REACT_SERVICE_URL` | ||
| - Customer URL for the render service (eg. for changing port) | ||
| - Default: `http://localhost:63578/render` | ||
| - `REACT_FAIL_SAFE` | ||
| - If there is a problem with the service, do not raise an exception, and return empty HTML | ||
| (allowing the client-side JS to take over) | ||
| - Default: `False` | ||
| - `REACT_TIMEOUT` | ||
| - How long (in seconds) should it wait for nodejs to render the component | ||
| - Default: `10` | ||
| Running the tests | ||
@@ -122,0 +137,0 @@ ----------------- |
+1
-1
| from setuptools import setup, find_packages | ||
| VERSION = '1.3.1' | ||
| VERSION = '1.3.2' | ||
@@ -5,0 +5,0 @@ setup( |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
16411
6.1%21
10.53%124
6.9%