mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2025-06-29 00:35:45 +08:00
Improved docker related files and added redis server for django channels
This commit is contained in:
parent
8d88424159
commit
7053f1d487
7 changed files with 333 additions and 198 deletions
|
@ -21,7 +21,6 @@ load_dotenv() # loads the configs from .env
|
|||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/
|
||||
|
||||
|
@ -161,7 +160,6 @@ REST_FRAMEWORK = {
|
|||
|
||||
WSGI_APPLICATION = 'config.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
|
@ -262,3 +260,12 @@ LEAFLET_CONFIG = {
|
|||
'SCALE': 'both',
|
||||
'TILES': 'https://openstreetmap.keannu1.duckdns.org/tile/{z}/{x}/{y}.png'
|
||||
}
|
||||
|
||||
CHANNEL_LAYERS = {
|
||||
"default": {
|
||||
"BACKEND": "channels_redis.core.RedisChannelLayer",
|
||||
"CONFIG": {
|
||||
"hosts": [("127.0.0.1", 6379)],
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
15
stude/wait_for_redis.py
Normal file
15
stude/wait_for_redis.py
Normal file
|
@ -0,0 +1,15 @@
|
|||
import time
|
||||
import os
|
||||
import redis
|
||||
|
||||
REDIS_HOST = os.getenv('REDIS_HOST', 'localhost')
|
||||
REDIS_PORT = os.getenv('REDIS_PORT', 6379)
|
||||
|
||||
if __name__ == '__main__':
|
||||
while True:
|
||||
try:
|
||||
redis.Redis(host=REDIS_HOST, port=REDIS_PORT)
|
||||
print('Redis is up!')
|
||||
break
|
||||
except redis.ConnectionError:
|
||||
time.sleep(0.1)
|
Loading…
Add table
Add a link
Reference in a new issue