django-orchestra/orchestra/utils/paths.py

25 lines
652 B
Python
Raw Permalink Normal View History

2014-05-08 16:59:35 +00:00
import os
def get_project_dir():
2014-05-08 16:59:35 +00:00
""" Return the current project path site/project """
from django.conf import settings
settings_file = os.sys.modules[settings.SETTINGS_MODULE].__file__
return os.path.dirname(os.path.normpath(settings_file))
def get_project_name():
""" Returns current project name """
return os.path.basename(get_project_dir())
2014-05-08 16:59:35 +00:00
def get_site_dir():
2014-05-08 16:59:35 +00:00
""" Returns project site path """
return os.path.abspath(os.path.join(get_project_dir(), '..'))
2014-05-08 16:59:35 +00:00
def get_orchestra_dir():
2014-05-08 16:59:35 +00:00
""" Returns orchestra base path """
import orchestra
return os.path.dirname(os.path.realpath(orchestra.__file__))