   (csrf-err-handler req))
 
 (def wrap-defaults-config
-  (-> site-defaults
+  (-> ring-mw/site-defaults
       (assoc-in [:session :cookie-attrs :max-age] 3600)
       (assoc-in [:session :cookie-name] "stonecutter-session")
       (assoc-in [:security :anti-forgery] {:error-handler handle-anti-forgery-error})))
 
 (defn create-site-app [dev-mode?]
-  (-> (scenic-handler routes site-handlers not-found)
-      (wrap-defaults wrap-defaults-config)
+  (-> (scenic/scenic-handler routes/routes site-handlers not-found)
+      (ring-mw/wrap-defaults wrap-defaults-config)
       m/wrap-translator
-      (m/wrap-error-handling err-handler dev-mode?)
-      ))
+      (m/wrap-error-handling err-handler dev-mode?)))
 
 (defn create-api-app [dev-mode?]
-  (-> (scenic-handler routes api-handlers not-found)
-      (wrap-defaults api-defaults)
+  (-> (scenic/scenic-handler routes/routes api-handlers not-found)
+      (ring-mw/wrap-defaults ring-mw/api-defaults)
       (m/wrap-error-handling err-handler dev-mode?)))                   ;; TODO create json error handler
 
 (defn create-app [& {dev-mode? :dev-mode?}]

(ns stonecutter.handler
  (:require [ring.middleware.defaults :refer [wrap-defaults site-defaults api-defaults]]
            [ring.util.response :as r]
            [ring.adapter.jetty :refer [run-jetty]]
            [environ.core :refer [env]]
            [scenic.routes :refer [scenic-handler]]
            [clojure.tools.logging :as log]
            [clauth.endpoints :as ep]
            [stonecutter.view.error :as error]
            [stonecutter.view.view-helpers :refer [enable-template-caching! disable-template-caching!]]
            [stonecutter.db.storage :as s]
            [stonecutter.helper :refer :all]
            [stonecutter.routes :refer [routes path]]
            [stonecutter.logging :as log-config]
            [stonecutter.client :as client]
            [stonecutter.controller.user :as user]

(def default-context {:translator (t/translations-fn t/translation-map)})

(defn not-found [request]
  (-> (sh/html-response (error/not-found-error default-context))
      (r/status 404)))

(defn err-handler [request]
  (-> (sh/html-response (error/internal-server-error default-context))
      (r/status 500)))

(defn csrf-err-handler [req]
  (-> (sh/html-response (error/csrf-error default-context))
      (r/status 403)))

(def site-handlers
