Skip to content

Commit a2f29fd

Browse files
committed
added documentation
1 parent 6f9193c commit a2f29fd

File tree

3 files changed

+50
-11
lines changed

3 files changed

+50
-11
lines changed

README.md

Lines changed: 46 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ REACT_BUILD_DIRECTORY = os.path.join(BASE_DIR, 'app', 'react', 'build')
5454
'DEFAULT': {
5555
'BUNDLE_DIR_NAME': REACT_BUILD_DIRECTORY,
5656
'FRONT_END_SERVER': "http://localhost:3000/",
57-
'is_dev': False,
57+
'IS_DEV': False,
5858
}
5959
}
6060
```
@@ -93,20 +93,25 @@ STATICFILES_DIRS = (
9393
9494
CREATE_REACT_APP = {
9595
'DEFAULT': {
96-
'BUNDLE_DIR_NAME': CLIENT_FRONTEND_BUILD,
96+
'BUNDLE_DIR_NAME': REACT_BUILD,
9797
'FRONT_END_SERVER': "http://localhost:3000/",
98-
'is_dev': True,
99-
},
98+
'IS_DEV': False,
99+
"PUBLIC_PATH_DEV": "http://localhost:3000/",
100+
"PUBLIC_PATH": "/static/"
101+
}
100102
'ADMIN': {
101-
'BUNDLE_DIR_NAME': ADMIN_FRONTEND_BUILD,
102-
'FRONT_END_SERVER': "http://localhost:3001/",
103-
'is_dev': True,
103+
'BUNDLE_DIR_NAME': REACT_BUILD,
104+
'FRONT_END_SERVER': "http://localhost:3000/",
105+
'IS_DEV': False,
104106
},
105107
}
106108
107109
108110
```
109111

112+
113+
114+
110115
### Rendering react admin app inside templates ::
111116
```
112117
{% load react_bundle_loader %}
@@ -122,3 +127,37 @@ CREATE_REACT_APP = {
122127
</head>
123128
124129
```
130+
131+
132+
### Using Preloading ::
133+
The is_preload=True option in the render_bundle_css or render_bundle_js template tag can be used to add rel="preload" link tags.
134+
```
135+
{% render_bundle_css is_preload=True %}
136+
137+
```
138+
139+
### Add attributes
140+
add some extra attributes to the tag
141+
```
142+
{% render_bundle_js attrib="async" %}
143+
144+
{% render_bundle_js attrib="disabled" %}
145+
```
146+
147+
148+
### migration from 0.8.4 to 0.9
149+
"is_dev" changed to "IS_DEV"
150+
is_dev in lowercase will not work
151+
152+
153+
### docker support
154+
PUBLIC_PATH_DEV default value will be FRONT_END_SERVER, which will be used for incase of docker
155+
156+
PUBLIC_PATH_DEV will be used in case of docker to http://localhost:3000/
157+
FRONT_END_SERVER: host.docker.internal
158+
159+
### django storage support
160+
161+
change PUBLIC_PATH to storagepath e.g
162+
163+
PUBLIC_PATH:"https://234234234.aws.com/static/"

create_react_app/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
'BUNDLE_DIR_NAME': '/Users/aamirbhatt/workspace/hack_django_react/dashboard/static',
1515
'LOADER_CLASS': 'create_react_app.loader.CreateReactLoader',
1616
'FRONT_END_SERVER': "http://localhost:3000/",
17-
'PUBLIC_PATH': "static/",
17+
'PUBLIC_PATH': "/static/",
1818
"PUBLIC_PATH_DEV": "/",
1919
'IS_DEV': False
2020
}

examples/hybrid/hybrid/settings.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@
120120
'DEFAULT': {
121121
'BUNDLE_DIR_NAME': REACT_BUILD,
122122
'FRONT_END_SERVER': "http://localhost:3000/",
123-
'IS_DEV': False,
124-
"PUBLIC_PATH_DEV": "http://localhost:3000/",
125-
"PUBLIC_PATH": "/static/"
123+
'IS_DEV': True,
124+
# "PUBLIC_PATH_DEV": "http://localhost:3000/",
125+
# "PUBLIC_PATH": "/static/"
126126
}
127127
}
128128

0 commit comments

Comments
 (0)