diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 67dc84c19dd9751928847e247c822c259e2afcce..07ffa2acbd592d5617b7f3e21e66c4f10f23acb7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -99,7 +99,7 @@ deploy-webserver-targetcentric:
     - cd ansible
     - whoami
     - ansible-playbook -vvv -i ./hosts_master deploy.yaml 
-      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_targetcentric galaxy_base_url=$GALAXY_BASE_URL_targetcentric galaxy_apikey=$GALAXY_APIKEY_targetcentric galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_targetcentric secret_key=$SECRET_KEY_targetcentric dbname=$DBNAME_targetcentric dbuser=$DBUSER_targetcentric dbpassword=$DBPASSWORD_targetcentric dbhost=$DBHOST_targetcentric dbport=$DBPORT_targetcentric http_port=$HTTP_PORT_targetcentric branch=$CI_COMMIT_REF_NAME gacode=$GACODE_targetcentric"
+      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_targetcentric galaxy_base_url=$GALAXY_BASE_URL_targetcentric galaxy_apikey=$GALAXY_APIKEY_targetcentric galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_targetcentric secret_key=$SECRET_KEY_targetcentric dbname=$DBNAME_targetcentric dbuser=$DBUSER_targetcentric dbpassword=$DBPASSWORD_targetcentric dbhost=$DBHOST_targetcentric dbport=$DBPORT_targetcentric http_port=$HTTP_PORT_targetcentric branch=$CI_COMMIT_REF_NAME gacode=$GACODE_targetcentric ippidb_media=$IPPIDB_MEDIA_targetcentric"
   only:
     - targetcentric
 
@@ -122,7 +122,7 @@ deploy-webserver-test:
     - cd ansible
     - whoami
     - ansible-playbook -vvv -i ./hosts_master deploy.yaml 
-      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_master galaxy_base_url=$GALAXY_BASE_URL_master galaxy_apikey=$GALAXY_APIKEY_master galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_master secret_key=$SECRET_KEY_master dbname=$DBNAME_master dbuser=$DBUSER_master dbpassword=$DBPASSWORD_master dbhost=$DBHOST_master dbport=$DBPORT_master http_port=$HTTP_PORT_master branch=$CI_COMMIT_REF_NAME gacode=$GACODE_master"
+      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_master galaxy_base_url=$GALAXY_BASE_URL_master galaxy_apikey=$GALAXY_APIKEY_master galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_master secret_key=$SECRET_KEY_master dbname=$DBNAME_master dbuser=$DBUSER_master dbpassword=$DBPASSWORD_master dbhost=$DBHOST_master dbport=$DBPORT_master http_port=$HTTP_PORT_master branch=$CI_COMMIT_REF_NAME gacode=$GACODE_master ippidb_media=$IPPIDB_MEDIA_master"
   only:
     - master
 
@@ -145,6 +145,6 @@ deploy-webserver-production:
     - cd ansible
     - whoami
     - ansible-playbook -vvv -i ./hosts_release deploy.yaml 
-      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_release galaxy_base_url=$GALAXY_BASE_URL_release galaxy_apikey=$GALAXY_APIKEY_release galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_release secret_key=$SECRET_KEY_release dbname=$DBNAME_release dbuser=$DBUSER_release dbpassword=$DBPASSWORD_release dbhost=$DBHOST_release dbport=$DBPORT_release http_port=$HTTP_PORT_release branch=$CI_COMMIT_REF_NAME  gacode=$GACODE_release"
+      --extra-vars "deploy_user_name=ippidb repo_api_token=JZS-4cH7bWkFkHa2rAVf marvinjs_apikey=$MARVINJS_APIKEY_release galaxy_base_url=$GALAXY_BASE_URL_release galaxy_apikey=$GALAXY_APIKEY_release galaxy_compoundproperties_workflowid=$GALAXY_COMPOUNDPROPERTIES_WORKFLOWID_release secret_key=$SECRET_KEY_release dbname=$DBNAME_release dbuser=$DBUSER_release dbpassword=$DBPASSWORD_release dbhost=$DBHOST_release dbport=$DBPORT_release http_port=$HTTP_PORT_release branch=$CI_COMMIT_REF_NAME  gacode=$GACODE_release ippidb_media=$IPPIDB_MEDIA_release"
   only:
     - release
diff --git a/ansible/deploy.yaml b/ansible/deploy.yaml
index 3d50d455f3bd657cc0c9d2cfd36ac31df7320571..75355b76d492c29cfc9d7d4e2a2725cce6676603 100644
--- a/ansible/deploy.yaml
+++ b/ansible/deploy.yaml
@@ -231,6 +231,12 @@
           GA_CODE = "{{ gacode }}"
         marker: "# {mark} ANSIBLE MANAGED GOOGLE ANALYTICS ID"
       when: gacode is defined
+    - name: Add media_url setting to iPPI-DB settings
+      blockinfile:
+        path: "{{ checkout_path }}/ippisite/ippisite/{{ ansible_hostname }}_settings.py"
+        block: |
+          MEDIA_URL = "{{ ippidb_media }}"
+        marker: "# {mark} ANSIBLE MEDIA_URL SETTINGS"
     - name: Add email/debug settings to iPPI-DB settings
       blockinfile:
         path: "{{ checkout_path }}/ippisite/ippisite/{{ ansible_hostname }}_settings.py"
diff --git a/ippisite/ippisite/settings.py b/ippisite/ippisite/settings.py
index 30f909d8f92cca3ff74faa7197b87abce06cc66d..eba17e7adbf26a50e0ee19c4a1c06194758c43d3 100644
--- a/ippisite/ippisite/settings.py
+++ b/ippisite/ippisite/settings.py
@@ -178,7 +178,7 @@ LOGIN_REDIRECT_URL = "/"
 LOGOUT_REDIRECT_URL = "/"
 
 MEDIA_URL = "/media/"
-MEDIA_ROOT = BASE_DIR + MEDIA_URL
+MEDIA_ROOT = BASE_DIR + "/media/"
 
 ################################################################################
 # fingerprints used to compute Drugbank similarity using openbabel
diff --git a/ippisite/ippisite/settings.template.py b/ippisite/ippisite/settings.template.py
index c4f1b3c917562d7087fbf65255b455a46c62d233..bf31edfcc038d87e59da4b4daabd28b05464628e 100644
--- a/ippisite/ippisite/settings.template.py
+++ b/ippisite/ippisite/settings.template.py
@@ -165,8 +165,9 @@ LOGIN_REDIRECT_URL = "/"
 
 LOGOUT_REDIRECT_URL = "/"
 
+# WARNING MEDIA_URL is surcharged by CI during deployment with ci variable IPPIDB_ROOT
 MEDIA_URL = "/media/"
-MEDIA_ROOT = BASE_DIR + MEDIA_URL
+MEDIA_ROOT = BASE_DIR + "/media/"
 
 ################################################################################
 # fingerprints used to compute Drugbank similarity using openbabel