mirror of
https://github.com/lemeow125/Borrowing-TrackerBackend.git
synced 2025-04-27 10:11:24 +08:00
Migrate to postgres, add memcache and vastly improve available equipment instance query time from 1min 30 seconds to 12 seconds
This commit is contained in:
parent
0af8efa793
commit
b0b1f4db86
24 changed files with 1253 additions and 292 deletions
|
@ -28,9 +28,9 @@ BASE_DIR = Path(__file__).resolve().parent.parent
|
|||
SECRET_KEY = str(os.getenv('SECRET_KEY'))
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = False
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '*']
|
||||
CSRF_TRUSTED_ORIGINS = [
|
||||
"https://csm-frontend.keannu1.duckdns.org", "https://csm-backend.keannu1.duckdns.org"]
|
||||
|
||||
|
@ -156,10 +156,21 @@ WSGI_APPLICATION = 'config.wsgi.application'
|
|||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
# DATABASES = {
|
||||
# 'default': {
|
||||
# 'ENGINE': 'django.db.backends.sqlite3',
|
||||
# 'NAME': BASE_DIR / 'db.sqlite3',
|
||||
# }
|
||||
# }
|
||||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': os.getenv('DB_NAME'),
|
||||
'USER': os.getenv('DB_USER'),
|
||||
'PASSWORD': os.getenv('DB_PASSWORD'),
|
||||
'HOST': os.getenv('DB_HOST', 'postgres'),
|
||||
'PORT': os.getenv('DB_PORT', '5432'),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,3 +240,10 @@ SESSION_CACHE_ALIAS = "default"
|
|||
|
||||
CORS_ALLOW_ALL_ORIGINS = True
|
||||
CORS_ALLOW_CREDENTIALS = True
|
||||
|
||||
CACHES = {
|
||||
'default': {
|
||||
'BACKEND': "django.core.cache.backends.memcached.PyMemcacheCache",
|
||||
'LOCATION': 'memcached:11211',
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue