Spaces:
Sleeping
Sleeping
Download webapp/apps.py from PeaceAbolisher/Model_Lab_Deployment: direct link, hf CLI and curl.
- Browser
- Download file 849 Bytes
-
https://huggingface.co/spaces/PeaceAbolisher/Model_Lab_Deployment/resolve/main/webapp/apps.py
- Command line
-
hf download hf://spaces/PeaceAbolisher/Model_Lab_Deployment/webapp/apps.py
-
curl -L -o apps.py https://huggingface.co/spaces/PeaceAbolisher/Model_Lab_Deployment/resolve/main/webapp/apps.py
849 Bytes
| # webapp/apps.py | |
| from django.apps import AppConfig | |
| from django.core.management import call_command | |
| from django.db.utils import OperationalError, ProgrammingError | |
| class WebappConfig(AppConfig): | |
| default_auto_field = "django.db.models.BigAutoField" | |
| name = "webapp" | |
| def ready(self): | |
| """ | |
| Ensure the database cache table exists. | |
| This runs on startup in each process. If the table already exists | |
| or the DB isn't ready yet, we just ignore the error. | |
| """ | |
| try: | |
| call_command("createcachetable", "django_cache", verbosity=0) | |
| except (OperationalError, ProgrammingError): | |
| # Table already exists or DB not ready; safe to ignore | |
| pass | |
| except Exception: | |
| # Any other weird error: ignore as well, we just won't have DB cache | |
| pass | |