PeaceAbolisher commited on
Commit
58ba040
·
verified ·
1 Parent(s): 41d68b5

attempt to fix 0%

Browse files
Files changed (1) hide show
  1. webapp/apps.py +21 -3
webapp/apps.py CHANGED
@@ -1,6 +1,24 @@
 
1
  from django.apps import AppConfig
2
-
 
3
 
4
  class WebappConfig(AppConfig):
5
- default_auto_field = 'django.db.models.BigAutoField'
6
- name = 'webapp'
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # webapp/apps.py
2
  from django.apps import AppConfig
3
+ from django.core.management import call_command
4
+ from django.db.utils import OperationalError, ProgrammingError
5
 
6
  class WebappConfig(AppConfig):
7
+ default_auto_field = "django.db.models.BigAutoField"
8
+ name = "webapp"
9
+
10
+ def ready(self):
11
+ """
12
+ Ensure the database cache table exists.
13
+
14
+ This runs on startup in each process. If the table already exists
15
+ or the DB isn't ready yet, we just ignore the error.
16
+ """
17
+ try:
18
+ call_command("createcachetable", "django_cache", verbosity=0)
19
+ except (OperationalError, ProgrammingError):
20
+ # Table already exists or DB not ready; safe to ignore
21
+ pass
22
+ except Exception:
23
+ # Any other weird error: ignore as well, we just won't have DB cache
24
+ pass