@@ -19,7 +19,7 @@ def reactpy_warnings(app_configs, **kwargs):
1919 warnings = []
2020 INSTALLED_APPS : list [str ] = getattr (settings , "INSTALLED_APPS" , [])
2121
22- # REACTPY_DATABASE is not an in-memory database.
22+ # Check if REACTPY_DATABASE is not an in-memory database.
2323 if (
2424 getattr (settings , "DATABASES" , {})
2525 .get (getattr (settings , "REACTPY_DATABASE" , "default" ), {})
@@ -36,7 +36,7 @@ def reactpy_warnings(app_configs, **kwargs):
3636 )
3737 )
3838
39- # ReactPy URLs exist
39+ # Check if ReactPy URLs are reachable
4040 try :
4141 reverse ("reactpy:web_modules" , kwargs = {"file" : "example" })
4242 reverse ("reactpy:view_to_iframe" , kwargs = {"dotted_path" : "example" })
@@ -143,14 +143,16 @@ def reactpy_warnings(app_configs, **kwargs):
143143 ):
144144 warnings .append (
145145 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." ,
147148 hint = "Add daphne to settings.py:INSTALLED_APPS." ,
148149 id = "reactpy_django.W012" ,
149150 )
150151 )
151152
152153 # DELETED W013: Check if deprecated value REACTPY_RECONNECT_MAX exists
153154
155+ # Check if REACTPY_RECONNECT_INTERVAL is set to a large value
154156 if (
155157 isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
156158 and config .REACTPY_RECONNECT_INTERVAL > 30000
@@ -164,20 +166,22 @@ def reactpy_warnings(app_configs, **kwargs):
164166 )
165167 )
166168
169+ # Check if REACTPY_RECONNECT_MAX_RETRIES is set to a large value
167170 if (
168171 isinstance (config .REACTPY_RECONNECT_MAX_RETRIES , int )
169172 and config .REACTPY_RECONNECT_MAX_RETRIES > 5000
170173 ):
171174 warnings .append (
172175 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? "
174178 "This may leave your clients attempting reconnections for a long time." ,
175179 hint = "Check your value for REACTPY_RECONNECT_MAX_RETRIES or suppress this warning." ,
176180 id = "reactpy_django.W015" ,
177181 )
178182 )
179183
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
181185 if (
182186 isinstance (config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER , (int , float ))
183187 and config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER > 100
@@ -190,6 +194,7 @@ def reactpy_warnings(app_configs, **kwargs):
190194 )
191195 )
192196
197+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is reachable
193198 if (
194199 isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int )
195200 and isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
@@ -222,6 +227,7 @@ def reactpy_warnings(app_configs, **kwargs):
222227 )
223228 )
224229
230+ # Check if 'reactpy_django' is in the correct position in INSTALLED_APPS
225231 position_to_beat = 0
226232 for app in INSTALLED_APPS :
227233 if app .startswith ("django.contrib." ):
@@ -238,6 +244,7 @@ def reactpy_warnings(app_configs, **kwargs):
238244 )
239245 )
240246
247+ # Check if REACTPY_CLEAN_SESSION is not a valid property
241248 if getattr (settings , "REACTPY_CLEAN_SESSION" , None ):
242249 warnings .append (
243250 Warning (
@@ -284,7 +291,7 @@ def reactpy_errors(app_configs, **kwargs):
284291 )
285292 )
286293
287- # All settings in reactpy_django.conf are the correct data type
294+ # Check if REACTPY_URL_PREFIX is a valid data type
288295 if not isinstance (getattr (settings , "REACTPY_URL_PREFIX" , "" ), str ):
289296 errors .append (
290297 Error (
@@ -294,6 +301,8 @@ def reactpy_errors(app_configs, **kwargs):
294301 id = "reactpy_django.E003" ,
295302 )
296303 )
304+
305+ # Check if REACTPY_SESSION_MAX_AGE is a valid data type
297306 if not isinstance (getattr (settings , "REACTPY_SESSION_MAX_AGE" , 0 ), int ):
298307 errors .append (
299308 Error (
@@ -303,6 +312,8 @@ def reactpy_errors(app_configs, **kwargs):
303312 id = "reactpy_django.E004" ,
304313 )
305314 )
315+
316+ # Check if REACTPY_CACHE is a valid data type
306317 if not isinstance (getattr (settings , "REACTPY_CACHE" , "" ), str ):
307318 errors .append (
308319 Error (
@@ -312,6 +323,8 @@ def reactpy_errors(app_configs, **kwargs):
312323 id = "reactpy_django.E005" ,
313324 )
314325 )
326+
327+ # Check if REACTPY_DATABASE is a valid data type
315328 if not isinstance (getattr (settings , "REACTPY_DATABASE" , "" ), str ):
316329 errors .append (
317330 Error (
@@ -321,6 +334,8 @@ def reactpy_errors(app_configs, **kwargs):
321334 id = "reactpy_django.E006" ,
322335 )
323336 )
337+
338+ # Check if REACTPY_DEFAULT_QUERY_POSTPROCESSOR is a valid data type
324339 if not isinstance (
325340 getattr (settings , "REACTPY_DEFAULT_QUERY_POSTPROCESSOR" , "" ), (str , type (None ))
326341 ):
@@ -332,6 +347,8 @@ def reactpy_errors(app_configs, **kwargs):
332347 id = "reactpy_django.E007" ,
333348 )
334349 )
350+
351+ # Check if REACTPY_AUTH_BACKEND is a valid data type
335352 if not isinstance (getattr (settings , "REACTPY_AUTH_BACKEND" , "" ), str ):
336353 errors .append (
337354 Error (
@@ -344,6 +361,7 @@ def reactpy_errors(app_configs, **kwargs):
344361
345362 # DELETED E009: Check if `channels` is in INSTALLED_APPS
346363
364+ # Check if REACTPY_DEFAULT_HOSTS is a valid data type
347365 if not isinstance (getattr (settings , "REACTPY_DEFAULT_HOSTS" , []), list ):
348366 errors .append (
349367 Error (
@@ -354,7 +372,7 @@ def reactpy_errors(app_configs, **kwargs):
354372 )
355373 )
356374
357- # Check of all values in the list are strings
375+ # Check of all values in the REACTPY_DEFAULT_HOSTS are strings
358376 if isinstance (getattr (settings , "REACTPY_DEFAULT_HOSTS" , None ), list ):
359377 for host in settings .REACTPY_DEFAULT_HOSTS :
360378 if not isinstance (host , str ):
@@ -368,6 +386,7 @@ def reactpy_errors(app_configs, **kwargs):
368386 )
369387 break
370388
389+ # Check if REACTPY_RECONNECT_INTERVAL is a valid data type
371390 if not isinstance (config .REACTPY_RECONNECT_INTERVAL , int ):
372391 errors .append (
373392 Error (
@@ -377,6 +396,7 @@ def reactpy_errors(app_configs, **kwargs):
377396 )
378397 )
379398
399+ # Check if REACTPY_RECONNECT_INTERVAL is a positive integer
380400 if (
381401 isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
382402 and config .REACTPY_RECONNECT_INTERVAL < 0
@@ -389,6 +409,7 @@ def reactpy_errors(app_configs, **kwargs):
389409 )
390410 )
391411
412+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is a valid data type
392413 if not isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int ):
393414 errors .append (
394415 Error (
@@ -398,6 +419,7 @@ def reactpy_errors(app_configs, **kwargs):
398419 )
399420 )
400421
422+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is a positive integer
401423 if (
402424 isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int )
403425 and config .REACTPY_RECONNECT_MAX_INTERVAL < 0
@@ -410,6 +432,7 @@ def reactpy_errors(app_configs, **kwargs):
410432 )
411433 )
412434
435+ # Check if REACTPY_RECONNECT_MAX_INTERVAL is greater than REACTPY_RECONNECT_INTERVAL
413436 if (
414437 isinstance (config .REACTPY_RECONNECT_MAX_INTERVAL , int )
415438 and isinstance (config .REACTPY_RECONNECT_INTERVAL , int )
@@ -423,6 +446,7 @@ def reactpy_errors(app_configs, **kwargs):
423446 )
424447 )
425448
449+ # Check if REACTPY_RECONNECT_MAX_RETRIES is a valid data type
426450 if not isinstance (config .REACTPY_RECONNECT_MAX_RETRIES , int ):
427451 errors .append (
428452 Error (
@@ -432,6 +456,7 @@ def reactpy_errors(app_configs, **kwargs):
432456 )
433457 )
434458
459+ # Check if REACTPY_RECONNECT_MAX_RETRIES is a positive integer
435460 if (
436461 isinstance (config .REACTPY_RECONNECT_MAX_RETRIES , int )
437462 and config .REACTPY_RECONNECT_MAX_RETRIES < 0
@@ -444,6 +469,7 @@ def reactpy_errors(app_configs, **kwargs):
444469 )
445470 )
446471
472+ # Check if REACTPY_RECONNECT_BACKOFF_MULTIPLIER is a valid data type
447473 if not isinstance (config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER , (int , float )):
448474 errors .append (
449475 Error (
@@ -453,6 +479,7 @@ def reactpy_errors(app_configs, **kwargs):
453479 )
454480 )
455481
482+ # Check if REACTPY_RECONNECT_BACKOFF_MULTIPLIER is greater than or equal to 1
456483 if (
457484 isinstance (config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER , (int , float ))
458485 and config .REACTPY_RECONNECT_BACKOFF_MULTIPLIER < 1
@@ -465,6 +492,7 @@ def reactpy_errors(app_configs, **kwargs):
465492 )
466493 )
467494
495+ # Check if REACTPY_PRERENDER is a valid data type
468496 if not isinstance (config .REACTPY_PRERENDER , bool ):
469497 errors .append (
470498 Error (
@@ -474,6 +502,7 @@ def reactpy_errors(app_configs, **kwargs):
474502 )
475503 )
476504
505+ # Check if REACTPY_AUTO_RELOGIN is a valid data type
477506 if not isinstance (config .REACTPY_AUTO_RELOGIN , bool ):
478507 errors .append (
479508 Error (
@@ -483,6 +512,7 @@ def reactpy_errors(app_configs, **kwargs):
483512 )
484513 )
485514
515+ # Check if REACTPY_CLEAN_INTERVAL is a valid data type
486516 if not isinstance (config .REACTPY_CLEAN_INTERVAL , (int , type (None ))):
487517 errors .append (
488518 Error (
@@ -492,6 +522,7 @@ def reactpy_errors(app_configs, **kwargs):
492522 )
493523 )
494524
525+ # Check if REACTPY_CLEAN_INTERVAL is a positive integer
495526 if (
496527 isinstance (config .REACTPY_CLEAN_INTERVAL , int )
497528 and config .REACTPY_CLEAN_INTERVAL < 0
@@ -504,6 +535,7 @@ def reactpy_errors(app_configs, **kwargs):
504535 )
505536 )
506537
538+ # Check if REACTPY_CLEAN_SESSIONS is a valid data type
507539 if not isinstance (config .REACTPY_CLEAN_SESSIONS , bool ):
508540 errors .append (
509541 Error (
@@ -513,6 +545,7 @@ def reactpy_errors(app_configs, **kwargs):
513545 )
514546 )
515547
548+ # Check if REACTPY_CLEAN_USER_DATA is a valid data type
516549 if not isinstance (config .REACTPY_CLEAN_USER_DATA , bool ):
517550 errors .append (
518551 Error (
0 commit comments