Skip to content

Commit

Permalink
update to local redis.
Browse files Browse the repository at this point in the history
pull allowed hosts from WEBSITE_HOSTNAME env parm
  • Loading branch information
jeffreykirchner committed Oct 25, 2023
1 parent 22e0cce commit 94b6c60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
5 changes: 3 additions & 2 deletions _fitbit_2/prod_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage'
STATIC_ROOT = 'main/static/'

ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS').split()
ALLOWED_HOSTS = [os.environ['WEBSITE_HOSTNAME']] if 'WEBSITE_HOSTNAME' in os.environ else []
CSRF_TRUSTED_ORIGINS = os.environ.get('CSRF_TRUSTED_ORIGINS').split()

# Database
Expand All @@ -31,7 +31,8 @@
'default': {
'BACKEND': 'channels_redis.core.RedisChannelLayer',
'CONFIG': {
'hosts': [(os.environ['REDIS'])],
# 'hosts': [(os.environ['REDIS'])],
'hosts' : [("localhost", 6379)],
'prefix' : 'fitbit_2',
},
},
Expand Down
7 changes: 6 additions & 1 deletion startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,10 @@ echo "Run Migrations:"
python manage.py migrate
echo "Install htop:"
apt-get -y install htop
echo "Install redis"
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list
apt-get update
apt-get -y install redis
echo "Start Daphne:"
daphne -b 0.0.0.0 _fitbit_2.asgi:application
redis-server & daphne -b 0.0.0.0 _fitbit_2.asgi:application

0 comments on commit 94b6c60

Please sign in to comment.