diff --git a/apps/common/__init__.py b/apps/common/__init__.py index a81e0d7711..a67194b9d2 100644 --- a/apps/common/__init__.py +++ b/apps/common/__init__.py @@ -17,7 +17,6 @@ from navigation.api import bind_links, register_top_menu from .settings import (AUTO_CREATE_ADMIN, AUTO_ADMIN_USERNAME, AUTO_ADMIN_PASSWORD, TEMPORARY_DIRECTORY) -from .utils import validate_path from .links import (link_password_change, link_current_user_details, link_current_user_edit, link_about, link_license, link_admin_site) from .models import AutoAdminSingleton @@ -69,7 +68,3 @@ def auto_admin_account_passwd_change(sender, instance, **kwargs): if instance == auto_admin_properties.account and instance.password != auto_admin_properties.password_hash: # Only delete the auto admin properties when the password has been changed auto_admin_properties.delete(force=True) - -# TODO: Fix -#if (validate_path(TEMPORARY_DIRECTORY) == False) or (not TEMPORARY_DIRECTORY): -# setattr(common_settings, 'TEMPORARY_DIRECTORY', tempfile.mkdtemp()) diff --git a/apps/common/post_init.py b/apps/common/post_init.py new file mode 100644 index 0000000000..78c2179ecb --- /dev/null +++ b/apps/common/post_init.py @@ -0,0 +1,11 @@ +from __future__ import absolute_import + +import tempfile + +from .utils import validate_path +import common.settings as common_settings + + +def init_validate_temp_path(): + if (validate_path(common_settings.TEMPORARY_DIRECTORY) == False) or (not common_settings.TEMPORARY_DIRECTORY): + setattr(common_settings, 'TEMPORARY_DIRECTORY', tempfile.mkdtemp())