fix: changed default debug value
This commit is contained in:
+6
-2
@@ -1,4 +1,5 @@
|
||||
from django.db import models
|
||||
from django.core.cache import cache
|
||||
|
||||
|
||||
class SingletonModel(models.Model):
|
||||
@@ -14,5 +15,8 @@ class SingletonModel(models.Model):
|
||||
|
||||
@classmethod
|
||||
def load(cls):
|
||||
obj, created = cls.objects.get_or_create(pk=1)
|
||||
return obj
|
||||
cache_key = f"{cls._meta.model_name}_singleton_key"
|
||||
if not (data := cache.get(cache_key)):
|
||||
data = cls.objects.values().get(pk=1)
|
||||
cache.set(cache_key, data, 60 * 60 * 24)
|
||||
return cls(**data)
|
||||
|
||||
@@ -13,7 +13,7 @@ if os.path.exists(env_file):
|
||||
environ.Env.read_env(env_file)
|
||||
|
||||
SECRET_KEY = env.str("SECRET_KEY", "this-is-the-default-secret-key")
|
||||
DEBUG = env.bool("DEBUG", True)
|
||||
DEBUG = env.bool("DEBUG", False)
|
||||
|
||||
CORS_ORIGIN_WHITELIST = env.str("CORS_ORIGIN_WHITELIST", "http://localhost:8000").split(
|
||||
","
|
||||
|
||||
Reference in New Issue
Block a user