diff --git a/cms/envs/common.py b/cms/envs/common.py
index a9be299409dff544c17820dfdede674266197bec..996228920593a4ce2d6aa48ed1f1a86fbdb38530 100644
--- a/cms/envs/common.py
+++ b/cms/envs/common.py
@@ -130,8 +130,8 @@ GEOIP_PATH = REPO_ROOT / "common/static/data/geoip/GeoIP.dat"
 
 ############################# WEB CONFIGURATION #############################
 # This is where we stick our compiled template files.
-from tempdir import mkdtemp_clean
-MAKO_MODULE_DIR = mkdtemp_clean('mako')
+import tempfile
+MAKO_MODULE_DIR = os.path.join(tempfile.gettempdir(), 'mako_cms')
 MAKO_TEMPLATES = {}
 MAKO_TEMPLATES['main'] = [
     PROJECT_ROOT / 'templates',
diff --git a/lms/envs/common.py b/lms/envs/common.py
index d1d764341d724b5704cd82ac3048fa14d031573b..6bfee20a7451ebfb6b938c7efe4419ef9db30f61 100644
--- a/lms/envs/common.py
+++ b/lms/envs/common.py
@@ -310,8 +310,8 @@ OPENID_PROVIDER_TRUSTED_ROOTS = ['cs50.net', '*.cs50.net']
 ################################## EDX WEB #####################################
 # This is where we stick our compiled template files. Most of the app uses Mako
 # templates
-from tempdir import mkdtemp_clean
-MAKO_MODULE_DIR = mkdtemp_clean('mako')
+import tempfile
+MAKO_MODULE_DIR = os.path.join(tempfile.gettempdir(), 'mako_lms')
 MAKO_TEMPLATES = {}
 MAKO_TEMPLATES['main'] = [PROJECT_ROOT / 'templates',
                           COMMON_ROOT / 'templates',