]> git.parisson.com Git - telemeta.git/commitdiff
add wait.py for available database
authorGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 25 Jan 2016 20:24:24 +0000 (21:24 +0100)
committerGuillaume Pellerin <guillaume.pellerin@ircam.fr>
Mon, 25 Jan 2016 20:24:24 +0000 (21:24 +0100)
app/deploy/start_app.sh
app/wait.py [new file with mode: 0644]

index 2cfb60c12c21781b52ae021c4d043b8495f558ef..4b626e0a7fdc6a32d00f8c48a4c430502fa1a5ae 100644 (file)
@@ -21,6 +21,9 @@ pip install django-environ redis
 # waiting for other services
 sh $app/deploy/wait.sh
 
+# waiting for available database
+python $app/wait.py
+
 # django init
 python $manage syncdb --noinput
 python $manage migrate --noinput
diff --git a/app/wait.py b/app/wait.py
new file mode 100644 (file)
index 0000000..eead53c
--- /dev/null
@@ -0,0 +1,14 @@
+#!/usr/bin/python
+
+import os, time
+from django.core.management import call_command
+
+up = False
+os.environ.setdefault("DJANGO_SETTINGS_MODULE", "sandbox.settings")
+
+while not up:
+    try:
+        call_command('syncdb', interactive=False)
+        up = True
+    except:
+        time.sleep(1)