]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/role/manifests/caldance.pp
Add media path to directly served files
[perso/Immae/Projets/Puppet.git] / modules / role / manifests / caldance.pp
index f44455f4be1ea61797e75bf80ca68c222afd18ba..1c87163c90b43bc2064f2eed0ad4fee0f58d1809 100644 (file)
@@ -39,6 +39,7 @@ class role::caldance (
     "SECRET_KEY"  => $secret_key,
     "DEBUG"       => "False",
     "LOG_FILE"    => "$home/caldev_django.log",
+    "MEDIA_ROOT"  => "$home/media",
     "FROM_EMAIL"  => $mail_from,
     "EMAIL_HOST"  => $smtp_host,
     "EMAIL_PORT"  => $smtp_port,
@@ -61,6 +62,12 @@ class role::caldance (
     owner   => $user,
     group   => $group,
     require => User["$user:"],
+  } ->
+  file { "${home}/media":
+    ensure => "directory",
+    mode   => "0755",
+    owner  => "http",
+    group  => "http",
   }
 
   exec { "initialize_venv":
@@ -182,6 +189,11 @@ class role::caldance (
         path    => "$caldance_app/www/static",
         require => "all granted",
       },
+      {
+        path    => "$home/media",
+        require => "all granted",
+        options => ["-Indexes"],
+      },
       {
         path           => "/",
         provider       => "location",
@@ -196,6 +208,10 @@ class role::caldance (
         alias => "/static/",
         path => "$caldance_app/www/static/",
       },
+      {
+        alias => "/media/",
+        path => "$home/media/",
+      },
     ],
     setenv              => $apache_env,
     wsgi_script_aliases => { "/" => "$caldance_app/main_app/wsgi.py" };