Commit 6e5f6f9e7d43ef2e30a7ceda2e42293150661468
1 parent
566178e4
Exists in
dev
on pyros/settings.py : add docker support (support remote mysql database)
Showing
1 changed file
with
12 additions
and
0 deletions
Show diff stats
src/core/pyros_django/pyros/settings.py
@@ -62,7 +62,15 @@ SECRET_KEY = '0*@w)$rq4x1c2w!c#gn58*$*u$w=s8uw2zpr_c3nj*u%qlxc23' | @@ -62,7 +62,15 @@ SECRET_KEY = '0*@w)$rq4x1c2w!c#gn58*$*u$w=s8uw2zpr_c3nj*u%qlxc23' | ||
62 | # SECURITY WARNING: don't run with debug turned on in production! | 62 | # SECURITY WARNING: don't run with debug turned on in production! |
63 | DEBUG = True | 63 | DEBUG = True |
64 | 64 | ||
65 | +# added 0.0.0.0, maybe try to map ip on docker -> search docker django runserver on localhost | ||
66 | +try: | ||
67 | + WITH_DOCKER = os.environ.get('WITH_DOCKER') | ||
68 | +except KeyError: | ||
69 | + WITH_DOCKER = False | ||
70 | + | ||
65 | ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'pyros.irap.omp.eu'] | 71 | ALLOWED_HOSTS = ['localhost', '127.0.0.1', 'pyros.irap.omp.eu'] |
72 | +if WITH_DOCKER: | ||
73 | + ALLOWED_HOSTS.append('0.0.0.0') | ||
66 | 74 | ||
67 | 75 | ||
68 | # Application definition | 76 | # Application definition |
@@ -174,6 +182,10 @@ if MYSQL: | @@ -174,6 +182,10 @@ if MYSQL: | ||
174 | }, | 182 | }, |
175 | } | 183 | } |
176 | } | 184 | } |
185 | + if WITH_DOCKER: | ||
186 | + # add host and port to connect to the database | ||
187 | + DATABASES['default']['HOST'] = 'db' | ||
188 | + DATABASES['default']['PORT'] = '3306' | ||
177 | 189 | ||
178 | else: | 190 | else: |
179 | DATABASES = { | 191 | DATABASES = { |