update config with src file
authorymh <ymh.work@gmail.com>
Mon, 08 Oct 2012 19:41:11 +0200
changeset 22 9f8db096d8f7
parent 21 87272c6be104
child 23 45b05706b516
update config with src file
README.markdown
sbin/sync/config.py.tmpl
sbin/sync/fabfile.py
--- a/README.markdown	Mon Oct 08 19:24:10 2012 +0200
+++ b/README.markdown	Mon Oct 08 19:41:11 2012 +0200
@@ -48,7 +48,7 @@
 Cette commande va créer un fichier de configuration minimal sur le serveur web à partir des informations renseignées dans le fichier config.py de l'étape précédente.
 
 4- Sur le serveur distant:
-* édition du fichier de configuration `<remote_web_path>/theend/config.py`.
+* édition du fichier de configuration `<remote_src_path>/theend/config.py`.
 * configuration du serveur web
 * du process uwsgi et de leur communication.
 
@@ -57,7 +57,7 @@
 
     [program:theend]
     command=<path to virtualenv>/bin/uwsgi --yaml /etc/uwsgi/theend.yml
-    directory=<path to web folder>
+    directory=<path to src folder>
     user=www-data
     autostart=true
     autorestart=true
@@ -73,9 +73,9 @@
       virtualenv: <path to virtualenv>
       processes: 5
       logto: /var/log/uwsgi/theend.log
-      chdir: <path to web folder>/theend
+      chdir: <path to src folder>/theend
       module: django_wsgi
-      pythonpath: <path to web folder>
+      pythonpath: <path to src folder>
 
 On peut remarquer ici qu'on utilise les socket unix pour faire communiquer le serveur web et le serveur uwsgi.
 
--- a/sbin/sync/config.py.tmpl	Mon Oct 08 19:24:10 2012 +0200
+++ b/sbin/sync/config.py.tmpl	Mon Oct 08 19:41:11 2012 +0200
@@ -8,6 +8,7 @@
 env.base_export_path = "<local path used to export hg version>"
 env.export_prefix = "theend"
 env.remote_web_path = "<path of website root folder on the server>"
+env.remote_src_path = "<path of website python src folder on the server>"
 env.platform_web_module = "theend"
 env.remote_virtualenv_path = "<path of the virtualenv on the server>"
 env.remote_venv_export_path = "<path for temporary export path of virtualenv resources>" 
@@ -16,16 +17,22 @@
     "+ core",
     "P .htpasswd",
     "P .htaccess",
-    "P theend/.htaccess",
-    "P theend/config.py",
-    "P theend/modwsgi.wsgi",
     "P robots.txt",
     "P env/***",
     "P log/***",
     "P index/***",
-    "P static/media/***",
+    "P static/media/***",    
     "P crossdomain.xml",
 ]
+env.src_rsync_filters = [
+    "+ core",
+    "P theend/.htaccess",
+    "P theend/config.py",
+    "P theend/modwsgi.wsgi",
+    "P log/***",
+    "P index/***",
+]
+
 env.venv_rsync_filters = [
     "+ core",
 ]
--- a/sbin/sync/fabfile.py	Mon Oct 08 19:24:10 2012 +0200
+++ b/sbin/sync/fabfile.py	Mon Oct 08 19:41:11 2012 +0200
@@ -132,6 +132,12 @@
     print("do_sync_web with version %s and path %s" % (version,export_path))
     web_path = os.path.join(export_path,"web/") 
     rsync_export(web_path, env.remote_web_path, env.web_rsync_filters)    
+
+def do_sync_src(version, export_path):
+    print("do_sync_web with version %s and path %s" % (version,export_path))
+    src_path = os.path.join(export_path,"src/") 
+    rsync_export(src_path, env.remote_src_path, env.src_rsync_filters)    
+
     
 def check_folder_access():
     print("Check folder access")
@@ -157,6 +163,7 @@
     print(green("sync web with version %s" % version))
     export_path = export_version(version)
     do_sync_web(version, export_path)
+    do_sync_src(version, export_path)
     create_config(export_path)
     clean_export_folder(export_path)
     relaunch_server()