@@ -19,7 +19,7 @@ def reactpy_warnings(app_configs, **kwargs):
19
19
warnings = []
20
20
INSTALLED_APPS : list [str ] = getattr (settings , "INSTALLED_APPS" , [])
21
21
22
- # REACTPY_DATABASE is not an in-memory database.
22
+ # Check if REACTPY_DATABASE is not an in-memory database.
23
23
if (
24
24
getattr (settings , "DATABASES" , {})
25
25
.get (getattr (settings , "REACTPY_DATABASE" , "default" ), {})
@@ -36,7 +36,7 @@ def reactpy_warnings(app_configs, **kwargs):
36
36
)
37
37
)
38
38
39
- # ReactPy URLs exist
39
+ # Check if ReactPy URLs are reachable
40
40
try :
41
41
reverse ("reactpy:web_modules" , kwargs = {"file" : "example" })
42
42
reverse ("reactpy:view_to_iframe" , kwargs = {"dotted_path" : "example" })
@@ -143,14 +143,16 @@ def reactpy_warnings(app_configs, **kwargs):
143
143
):
144
144
warnings .append (
145
145
Warning (
146
- "You have not configured runserver to use ASGI." ,
146
+ "You have not configured the `runserver` command to use ASGI. "
147
+ "ReactPy will work properly in this configuration." ,
147
148
hint = "Add daphne to settings.py:INSTALLED_APPS." ,
148
149
id = "reactpy_django.W012" ,
149
150
)
150
151
)
151
152
152
153
# DELETED W013: Check if deprecated value REACTPY_RECONNECT_MAX exists
153
154
155
+ # Check if REACTPY_RECONNECT_INTERVAL is set to a large value
154
156
if (
155
157
isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
156
158
and config .REACTPY_RECONNECT_INTERVAL > 30000
@@ -164,20 +166,22 @@ def reactpy_warnings(app_configs, **kwargs):
164
166
)
165
167
)
166
168
169
+ # Check if REACTPY_RECONNECT_MAX_RETRIES is set to a large value
167
170
if (
168
171
isinstance (config .REACTPY_RECONNECT_MAX_RETRIES , int )
169
172
and config .REACTPY_RECONNECT_MAX_RETRIES > 5000
170
173
):
171
174
warnings .append (
172
175
Warning (
173
- "REACTPY_RECONNECT_MAX_RETRIES is set to a very large value. Are you sure this is intentional? "
176
+ "REACTPY_RECONNECT_MAX_RETRIES is set to a very large value "
177
+ f"{ config .REACTPY_RECONNECT_MAX_RETRIES } . Are you sure this is intentional? "
174
178
"This may leave your clients attempting reconnections for a long time." ,
175
179
hint = "Check your value for REACTPY_RECONNECT_MAX_RETRIES or suppress this warning." ,
176
180
id = "reactpy_django.W015" ,
177
181
)
178
182
)
179
183
180
- # Check if the value is too large (greater than 50)
184
+ # Check if the REACTPY_RECONNECT_BACKOFF_MULTIPLIER is set to a large value
181
185
if (
182
186
isinstance (config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER , (int , float ))
183
187
and config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER > 100
@@ -190,6 +194,7 @@ def reactpy_warnings(app_configs, **kwargs):
190
194
)
191
195
)
192
196
197
+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is reachable
193
198
if (
194
199
isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int )
195
200
and isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
@@ -222,6 +227,7 @@ def reactpy_warnings(app_configs, **kwargs):
222
227
)
223
228
)
224
229
230
+ # Check if 'reactpy_django' is in the correct position in INSTALLED_APPS
225
231
position_to_beat = 0
226
232
for app in INSTALLED_APPS :
227
233
if app .startswith ("django.contrib." ):
@@ -238,6 +244,7 @@ def reactpy_warnings(app_configs, **kwargs):
238
244
)
239
245
)
240
246
247
+ # Check if REACTPY_CLEAN_SESSION is not a valid property
241
248
if getattr (settings , "REACTPY_CLEAN_SESSION" , None ):
242
249
warnings .append (
243
250
Warning (
@@ -284,7 +291,7 @@ def reactpy_errors(app_configs, **kwargs):
284
291
)
285
292
)
286
293
287
- # All settings in reactpy_django.conf are the correct data type
294
+ # Check if REACTPY_URL_PREFIX is a valid data type
288
295
if not isinstance (getattr (settings , "REACTPY_URL_PREFIX" , "" ), str ):
289
296
errors .append (
290
297
Error (
@@ -294,6 +301,8 @@ def reactpy_errors(app_configs, **kwargs):
294
301
id = "reactpy_django.E003" ,
295
302
)
296
303
)
304
+
305
+ # Check if REACTPY_SESSION_MAX_AGE is a valid data type
297
306
if not isinstance (getattr (settings , "REACTPY_SESSION_MAX_AGE" , 0 ), int ):
298
307
errors .append (
299
308
Error (
@@ -303,6 +312,8 @@ def reactpy_errors(app_configs, **kwargs):
303
312
id = "reactpy_django.E004" ,
304
313
)
305
314
)
315
+
316
+ # Check if REACTPY_CACHE is a valid data type
306
317
if not isinstance (getattr (settings , "REACTPY_CACHE" , "" ), str ):
307
318
errors .append (
308
319
Error (
@@ -312,6 +323,8 @@ def reactpy_errors(app_configs, **kwargs):
312
323
id = "reactpy_django.E005" ,
313
324
)
314
325
)
326
+
327
+ # Check if REACTPY_DATABASE is a valid data type
315
328
if not isinstance (getattr (settings , "REACTPY_DATABASE" , "" ), str ):
316
329
errors .append (
317
330
Error (
@@ -321,6 +334,8 @@ def reactpy_errors(app_configs, **kwargs):
321
334
id = "reactpy_django.E006" ,
322
335
)
323
336
)
337
+
338
+ # Check if REACTPY_DEFAULT_QUERY_POSTPROCESSOR is a valid data type
324
339
if not isinstance (
325
340
getattr (settings , "REACTPY_DEFAULT_QUERY_POSTPROCESSOR" , "" ), (str , type (None ))
326
341
):
@@ -332,6 +347,8 @@ def reactpy_errors(app_configs, **kwargs):
332
347
id = "reactpy_django.E007" ,
333
348
)
334
349
)
350
+
351
+ # Check if REACTPY_AUTH_BACKEND is a valid data type
335
352
if not isinstance (getattr (settings , "REACTPY_AUTH_BACKEND" , "" ), str ):
336
353
errors .append (
337
354
Error (
@@ -344,6 +361,7 @@ def reactpy_errors(app_configs, **kwargs):
344
361
345
362
# DELETED E009: Check if `channels` is in INSTALLED_APPS
346
363
364
+ # Check if REACTPY_DEFAULT_HOSTS is a valid data type
347
365
if not isinstance (getattr (settings , "REACTPY_DEFAULT_HOSTS" , []), list ):
348
366
errors .append (
349
367
Error (
@@ -354,7 +372,7 @@ def reactpy_errors(app_configs, **kwargs):
354
372
)
355
373
)
356
374
357
- # Check of all values in the list are strings
375
+ # Check of all values in the REACTPY_DEFAULT_HOSTS are strings
358
376
if isinstance (getattr (settings , "REACTPY_DEFAULT_HOSTS" , None ), list ):
359
377
for host in settings .REACTPY_DEFAULT_HOSTS :
360
378
if not isinstance (host , str ):
@@ -368,6 +386,7 @@ def reactpy_errors(app_configs, **kwargs):
368
386
)
369
387
break
370
388
389
+ # Check if REACTPY_RECONNECT_INTERVAL is a valid data type
371
390
if not isinstance (config .REACTPY_RECONNECT_INTERVAL , int ):
372
391
errors .append (
373
392
Error (
@@ -377,6 +396,7 @@ def reactpy_errors(app_configs, **kwargs):
377
396
)
378
397
)
379
398
399
+ # Check if REACTPY_RECONNECT_INTERVAL is a positive integer
380
400
if (
381
401
isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
382
402
and config .REACTPY_RECONNECT_INTERVAL < 0
@@ -389,6 +409,7 @@ def reactpy_errors(app_configs, **kwargs):
389
409
)
390
410
)
391
411
412
+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is a valid data type
392
413
if not isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int ):
393
414
errors .append (
394
415
Error (
@@ -398,6 +419,7 @@ def reactpy_errors(app_configs, **kwargs):
398
419
)
399
420
)
400
421
422
+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is a positive integer
401
423
if (
402
424
isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int )
403
425
and config .REACTPY_RECONNECT_MAX_INTERVAL < 0
@@ -410,6 +432,7 @@ def reactpy_errors(app_configs, **kwargs):
410
432
)
411
433
)
412
434
435
+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is greater than REACTPY_RECONNECT_INTERVAL
413
436
if (
414
437
isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int )
415
438
and isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
@@ -423,6 +446,7 @@ def reactpy_errors(app_configs, **kwargs):
423
446
)
424
447
)
425
448
449
+ # Check if REACTPY_RECONNECT_MAX_RETRIES is a valid data type
426
450
if not isinstance (config .REACTPY_RECONNECT_MAX_RETRIES , int ):
427
451
errors .append (
428
452
Error (
@@ -432,6 +456,7 @@ def reactpy_errors(app_configs, **kwargs):
432
456
)
433
457
)
434
458
459
+ # Check if REACTPY_RECONNECT_MAX_RETRIES is a positive integer
435
460
if (
436
461
isinstance (config .REACTPY_RECONNECT_MAX_RETRIES , int )
437
462
and config .REACTPY_RECONNECT_MAX_RETRIES < 0
@@ -444,6 +469,7 @@ def reactpy_errors(app_configs, **kwargs):
444
469
)
445
470
)
446
471
472
+ # Check if REACTPY_RECONNECT_BACKOFF_MULTIPLIER is a valid data type
447
473
if not isinstance (config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER , (int , float )):
448
474
errors .append (
449
475
Error (
@@ -453,6 +479,7 @@ def reactpy_errors(app_configs, **kwargs):
453
479
)
454
480
)
455
481
482
+ # Check if REACTPY_RECONNECT_BACKOFF_MULTIPLIER is greater than or equal to 1
456
483
if (
457
484
isinstance (config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER , (int , float ))
458
485
and config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER < 1
@@ -465,6 +492,7 @@ def reactpy_errors(app_configs, **kwargs):
465
492
)
466
493
)
467
494
495
+ # Check if REACTPY_PRERENDER is a valid data type
468
496
if not isinstance (config .REACTPY_PRERENDER , bool ):
469
497
errors .append (
470
498
Error (
@@ -474,6 +502,7 @@ def reactpy_errors(app_configs, **kwargs):
474
502
)
475
503
)
476
504
505
+ # Check if REACTPY_AUTO_RELOGIN is a valid data type
477
506
if not isinstance (config .REACTPY_AUTO_RELOGIN , bool ):
478
507
errors .append (
479
508
Error (
@@ -483,6 +512,7 @@ def reactpy_errors(app_configs, **kwargs):
483
512
)
484
513
)
485
514
515
+ # Check if REACTPY_CLEAN_INTERVAL is a valid data type
486
516
if not isinstance (config .REACTPY_CLEAN_INTERVAL , (int , type (None ))):
487
517
errors .append (
488
518
Error (
@@ -492,6 +522,7 @@ def reactpy_errors(app_configs, **kwargs):
492
522
)
493
523
)
494
524
525
+ # Check if REACTPY_CLEAN_INTERVAL is a positive integer
495
526
if (
496
527
isinstance (config .REACTPY_CLEAN_INTERVAL , int )
497
528
and config .REACTPY_CLEAN_INTERVAL < 0
@@ -504,6 +535,7 @@ def reactpy_errors(app_configs, **kwargs):
504
535
)
505
536
)
506
537
538
+ # Check if REACTPY_CLEAN_SESSIONS is a valid data type
507
539
if not isinstance (config .REACTPY_CLEAN_SESSIONS , bool ):
508
540
errors .append (
509
541
Error (
@@ -513,6 +545,7 @@ def reactpy_errors(app_configs, **kwargs):
513
545
)
514
546
)
515
547
548
+ # Check if REACTPY_CLEAN_USER_DATA is a valid data type
516
549
if not isinstance (config .REACTPY_CLEAN_USER_DATA , bool ):
517
550
errors .append (
518
551
Error (
0 commit comments