clean config file and do some correction in the sync script.
authorymh <ymh.work@gmail.com>
Fri, 31 Aug 2012 15:50:15 +0200
changeset 769 a49769a3088d
parent 768 85012ba55b83
child 772 164a06b49622
child 774 46098450b353
clean config file and do some correction in the sync script.
sbin/sync/config.py.tmpl
sbin/sync/fabfile.py
web/ldtplatform/config.py.tmpl
--- a/sbin/sync/config.py.tmpl	Thu Aug 30 15:29:09 2012 +0200
+++ b/sbin/sync/config.py.tmpl	Fri Aug 31 15:50:15 2012 +0200
@@ -3,7 +3,7 @@
 env.hosts = ['iri@web.iri.centrepompidou.fr']
 
 env.web_group = 'www-data'
-env.folders = ['index', 'log', 'static/media']
+env.folders = ['log', 'static/media']
 
 env.base_export_path = "~/tmp"
 env.export_prefix = "platform"
@@ -47,7 +47,6 @@
 env.db_port = 5432
 
 env.log_file = env.remote_web_path + '/log/log.txt'
-env.index_path = env.remote_web_path + '/index/'
 
 env.google_analytics_code = ""
 
@@ -57,3 +56,5 @@
 env.email_host_user = ""
 env.email_port = ""
 
+env.forbidden_stream_url = "rtmp://media.iri.centrepompidou.fr/ddc_player/mp4:video/forbidden_stream.mp4?old_path="
+
--- a/sbin/sync/fabfile.py	Thu Aug 30 15:29:09 2012 +0200
+++ b/sbin/sync/fabfile.py	Fri Aug 31 15:50:15 2012 +0200
@@ -12,7 +12,7 @@
 import config
 
 def get_export_path(version):
-    base_path = os.path.join(env.base_export_path,env.export_prefix).lstrip("/")
+    base_path = os.path.join(env.base_export_path,env.export_prefix).rstrip("/")
     return os.path.expanduser(base_path) + "_%s" % (str(version))
 
 def clean_export_folder(path):
@@ -31,7 +31,7 @@
     activate_path = os.path.join(remotevirtualenvpath, "bin/activate")
     res = ""
     with prefix("source \"%s\"" % activate_path), prefix("export PYTHONPATH=\"%s\"" % remotepath), cd(remotepath):
-        tempfilepath = run("mktemp --tmpdir ldtplatform.XXXXXX")
+        tempfilepath = run("mktemp -t ldtplatform.XXXXXX")
         with settings(warn_only=True):
             run("echo \"import os\" > %s" % (tempfilepath))
             map(lambda str: run("echo \"%s\" >> %s" % (str, tempfilepath)),
@@ -141,13 +141,13 @@
      'db_host': env.db_host,
      'db_port': env.db_port,
      'log_file': env.log_file,
-     'index_path': env.index_path,
      'google_analytics_code': env.google_analytics_code,
      'email_use_tls': env.email_use_tls,
      'email_host': env.email_host,
      'email_host_user': env.email_host_user,
      'email_host_user': env.email_host_user,
      'email_port': env.email_port,
+     'forbidden_stream_url': env.forbidden_stream_url,
     }
     
     if not exists(remote_config_path, verbose=True):
@@ -217,9 +217,9 @@
 @task
 def relaunch_server(do_collectstatic=True):
     print("Relaunch server")
+    check_folder_access()
     if do_collectstatic:
         collectstatic(env.remote_web_path, env.remote_virtualenv_path, env.platform_web_module)
-    check_folder_access()
     sudo(env.web_relaunch_cmd, shell=False)
 
 @task
--- a/web/ldtplatform/config.py.tmpl	Thu Aug 30 15:29:09 2012 +0200
+++ b/web/ldtplatform/config.py.tmpl	Fri Aug 31 15:50:15 2012 +0200
@@ -3,15 +3,16 @@
 
 SITE_ID = 1
 
-BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/"
-BASE_URL = '/~ymh/platform/'
-WEB_URL = 'http://localhost/'
+#BASE_DIR = os.path.dirname(os.path.abspath(__file__)).rstrip("/")+"/"
+BASE_DIR = '%(base_dir)s'
+BASE_URL = '%(base_url)s'
+WEB_URL = '%(web_url)s'
 STATIC_URL = BASE_URL + 'static/site/'
 
 
-STREAM_URL = "rtmp://localhost/vod/media/"
+STREAM_URL = "%(stream_url)s"
 
-STREAM_SRC_PREFIX = ""
+STREAM_SRC_PREFIX = "%(stream_src_prefix)s"
  
 BASE_STATIC_ROOT = os.path.abspath(BASE_DIR + "../static/").rstrip("/")+"/"
 BASE_STATIC_URL = BASE_URL + 'static/' 
@@ -26,7 +27,7 @@
 STATIC_ROOT = BASE_STATIC_ROOT + "site/"
 
 # PATH to the ffmpeg executable, used to know automatically the media file duration 
-FFMPEG_PATH = "C:/path/to/ffmpeg.exe"
+FFMPEG_PATH = "%(ffmpeg_path)s"
 
 
 CONTENT_ROOT = BASE_STATIC_ROOT + "content/"
@@ -41,12 +42,12 @@
 
 DATABASES = {
     'default': {
-        'ENGINE': 'django.db.backends.postgresql_psycopg2', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-        'NAME': 'platform',                      # Or path to database file if using sqlite3.
-        'USER': 'iri',                      # Not used with sqlite3.
-        'PASSWORD': 'iri',                  # Not used with sqlite3.
-        'HOST': 'localhost',                      # Set to empty string for localhost. Not used with sqlite3.
-        'PORT': '5432',                      # Set to empty string for default. Not used with sqlite3.
+        'ENGINE': 'django.db.backends.%(db_engine)s', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
+        'NAME': '%(db_name)s',                      # Or path to database file if using sqlite3.
+        'USER': '%(db_user)s',                      # Not used with sqlite3.
+        'PASSWORD': '%(db_password)s',                  # Not used with sqlite3.
+        'HOST': '%(db_host)s',                      # Set to empty string for localhost. Not used with sqlite3.
+        'PORT': '%(db_port)d',                      # Set to empty string for default. Not used with sqlite3.
     }
 }
 
@@ -59,12 +60,11 @@
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
-LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../log/log.txt"))
+#LOG_FILE = os.path.abspath(os.path.join(BASE_DIR,"../log/log.txt"))
+LOG_FILE = '%(log_file)s'
 LOG_LEVEL = logging.DEBUG
 logging.basicConfig(filename=LOG_FILE, level=LOG_LEVEL)
 
-INDEX_PATH = os.path.abspath(BASE_DIR + "../index/")
-
 
 ADMINS = (
     # ('Your Name', 'your_email@domain.com'),
@@ -72,13 +72,13 @@
 
 MANAGERS = ADMINS
 
-#GOOGLE_ANALYTICS_CODE = 'UA-1234-1'
+GOOGLE_ANALYTICS_CODE = '%(google_analytics_code)s'
 
-EMAIL_USE_TLS = True
-EMAIL_HOST = 'smtp.gmail.com'
-EMAIL_HOST_USER = 'iri.ddc@gmail.com'
-EMAIL_HOST_PASSWORD = 'ddciripompidou'
-EMAIL_PORT = 587 
+EMAIL_USE_TLS = %(email_use_tls)s
+EMAIL_HOST = '%(email_host)s'
+EMAIL_HOST_USER = '%(email_host_user)s'
+EMAIL_HOST_PASSWORD = '%(email_host_user)s'
+EMAIL_PORT = %(email_port)d 
 
 ACCOUNT_ACTIVATION_DAYS = 7
 REGISTRATION_OPEN = False
@@ -95,7 +95,7 @@
 
 AUTO_INDEX_AFTER_SAVE = True
 
-FORBIDDEN_STREAM_URL = "rtmp://media.iri.centrepompidou.fr/ddc_player/mp4:video/forbidden_stream.mp4?old_path="
+FORBIDDEN_STREAM_URL = "%(forbidden_stream_url)s"
 
 FRONT_TAG_LIST = [u"Enmi 2011", u"film", u"conférence"]