예제 #1
0
def get_build_exe_params(packager_list):
    build_exe_dir = "../%s/%s" % (target, os.path.basename(get_executable_folder()))

    ###########################
    # Add python module that is not automatically included in the build below. Such as Django app
    # file with special names other than: models, urls, admin, views etc.
    ###########################
    includes = []
    include_files = []
    excludes = []

    for package in packager_list:
        includes = combine(includes, package.get_include_module_names())
        include_files = combine_tuple(include_files, package.get_include_files_or_folders_with_target())
        excludes = combine(excludes, package.get_excluded_module_names())

    return {
        "includes": includes,
        'include_files': include_files,
        "bin_excludes": [],
        "build_exe": build_exe_dir,
        "zip_includes": [],
        'excludes': excludes
        # "packages": find_packages(),
        # "create_shared_zip": False,
    }
예제 #2
0
def get_build_exe_params(packager_list):
    build_exe_dir = "../%s/%s" % (target,
                                  os.path.basename(get_executable_folder()))

    ###########################
    # Add python module that is not automatically included in the build below. Such as Django app
    # file with special names other than: models, urls, admin, views etc.
    ###########################
    includes = []
    include_files = []
    excludes = []

    for package in packager_list:
        includes = combine(includes, package.get_include_module_names())
        include_files = combine_tuple(
            include_files, package.get_include_files_or_folders_with_target())
        excludes = combine(excludes, package.get_excluded_module_names())

    return {
        "includes": includes,
        'include_files': include_files,
        "bin_excludes": [],
        "build_exe": build_exe_dir,
        "zip_includes": [],
        'excludes': excludes
        # "packages": find_packages(),
        # "create_shared_zip": False,
    }
예제 #3
0
 def __init__(self, django_manage_script=None):
     super(DjangoServerBase, self).__init__()
     if django_manage_script is None:
         self.django_manage_script = self.default_django_manage_script
     else:
         self.django_manage_script = django_manage_script
     self.django_manage_script = os.environ.get("MANAGE_PY", self.django_manage_script)
     self.exe_folder = get_executable_folder()
 def __init__(self):
     self.external_app_repositories = "external_app_repos"
     if "ROOT_DIR" in os.environ:
         self.root_dir = os.environ["ROOT_DIR"]
     else:
         self.root_dir = get_executable_folder()
     self.server_base_package_folder_name = "server_base_packages"
     self.django_auto_conf = DjangoAutoConf()
예제 #5
0
 def get_run_server_task_descriptor(self, params=None):
     params = params or []
     exe_folder = get_executable_folder()
     cmd_and_param = [self.get_full_path("cherrypy_server.exe")]
     cmd_and_param.extend(params)
     # print "pwd:", os.getcwd()
     # print "!!!!!!!!!!!!!!!!!!!!!!!!!", exe_folder
     # os.chdir(exe_folder)
     return {"run server": cmd_and_param}
예제 #6
0
 def set_settings_env(executable_folder=None):
     """
     Add all application folders
     :param executable_folder: the folder that contains local and external_app_repos
     :return:
     """
     executable_folder = executable_folder or get_executable_folder()
     # print "!!!!!!!!!!!!!! executable:", executable_folder
     if os.path.exists(os.path.join(executable_folder, "local/total_settings.py")):
         print("Using total settings")
         os.chdir(executable_folder)
         os.environ["DJANGO_SETTINGS_MODULE"] = "local.total_settings"
         os.environ["STATIC_ROOT"] = os.path.join(executable_folder, "static")
         os.environ["MEDIA_ROOT"] = os.path.join(executable_folder, "media")
     else:
         os.environ.setdefault('ROOT_DIR', get_folder(get_inspection_frame(2)))
         os.environ["DJANGO_SETTINGS_MODULE"] = "djangoautoconf.base_settings"
    def create_default_structure(self):
        repo_root = os.path.abspath(get_executable_folder())
        target_repo_folder = os.path.join(
            repo_root, "external_app_repos/auto-generated-apps")
        target_app_folder = os.path.join(target_repo_folder, self.app_name)
        ensure_dir(target_repo_folder)
        if os.path.exists(target_app_folder):
            raise "Folder exists"
        else:
            os.mkdir(target_app_folder)
            self.module_path = os.path.join(target_app_folder,
                                            self.app_module_name)
            os.mkdir(self.module_path)
            os.mkdir(os.path.join(self.module_path, "migrations"))

            self.create_module_file("admin.py", self.admin_file_content)
            self.create_module_file("urls.py", self.urls_content)
            self.create_module_file("default_settings.py")
            self.create_module_file("__init__.py")
            self.create_module_file("migrations/__init__.py")
예제 #8
0
    def prepare(self):

        DjangoAutoConf.set_settings_env()
        import django
        django.setup()

        from django.conf import settings
        # include_files.extend(ModuleDescriptor().get_module_list_from_name("djangoautoconf"))

        # Include django by folder, for the following 2 reasons
        # 1. we need django template files which is not python modules
        # 2. Django module will include some module by a flag to check whether it is py3, but in cx_Freeze,
        # it can not detect such flag?
        # self._add_module_to_include_files("django")
        # self._add_module_to_include_files("cherrypy")
        # self._add_module_to_include_files("redis")
        for i in self.force_include_file:
            self._add_module_to_include_files(i)

        for installed_app in settings.INSTALLED_APPS:
            app_root_name = self.get_top_module(installed_app)
            self._add_module_to_include_files(app_root_name)

            self._include_default_files_in_django_app(app_root_name)

        new_modules = sys.modules.keys()

        for module in new_modules:
            app_root_name = self.get_top_module(module)
            self._add_module_to_includes(app_root_name)

        for m in self.force_include_module:
            self._add_module_to_includes(m)

        os.system(
            os.path.join(get_executable_folder(), "scripts/collectstatic.bat"))
        # os.system(os.path.join(root_folder, "scripts/collectcmd.bat"))
        os.system(sys.executable + " ./manage.py dump_settings")
예제 #9
0
    def prepare(self):

        DjangoAutoConf.set_settings_env()
        import django
        django.setup()

        from django.conf import settings
        # include_files.extend(ModuleDescriptor().get_module_list_from_name("djangoautoconf"))

        # Include django by folder, for the following 2 reasons
        # 1. we need django template files which is not python modules
        # 2. Django module will include some module by a flag to check whether it is py3, but in cx_Freeze,
        # it can not detect such flag?
        # self._add_module_to_include_files("django")
        # self._add_module_to_include_files("cherrypy")
        # self._add_module_to_include_files("redis")
        for i in self.force_include_file:
            self._add_module_to_include_files(i)

        for installed_app in settings.INSTALLED_APPS:
            app_root_name = self.get_top_module(installed_app)
            self._add_module_to_include_files(app_root_name)

            self._include_default_files_in_django_app(app_root_name)

        new_modules = sys.modules.keys()

        for module in new_modules:
            app_root_name = self.get_top_module(module)
            self._add_module_to_includes(app_root_name)

        for m in self.force_include_module:
            self._add_module_to_includes(m)

        os.system(os.path.join(get_executable_folder(), "scripts/collectstatic.bat"))
        # os.system(os.path.join(root_folder, "scripts/collectcmd.bat"))
        os.system(sys.executable + " ./manage.py dump_settings")
예제 #10
0
def find_resource_in_sub_folders(filename):
    p = get_executable_folder()
    for dirpath, dirnames, filenames in os.walk(p):
        if filename in filenames:
            # print 'find file:', os.path.join(dirpath, filename)
            return os.path.join(dirpath, filename)
예제 #11
0
 def __init__(self):
     super(FrozenApp, self).__init__()
     self.root_folder = get_executable_folder()
예제 #12
0
파일: libtool.py 프로젝트: weijia/ufs-tools
def include_all_direct_sub_folders_in_sibling_ex(sub_folder_name):
    include_all_direct_subfolders(os.path.join(get_executable_folder(), sub_folder_name))
예제 #13
0
 def get_cmd_str(self, cmd_name, param_list=[]):
     exe_folder = get_executable_folder()
     print "exe_folder in django_server:", exe_folder
     return "%s %s" % (self.get_full_path(self.django_manage_script), cmd_name)
예제 #14
0
파일: base.py 프로젝트: weijia/ufs-tools
 def get_root_folder(self):
     return get_executable_folder()
예제 #15
0
import logging
import sys
import os

from ufs_tools import get_folder
from ufs_tools.app_tools import get_executable_folder
from ufs_tools.basic_lib_tool import include
from ufs_tools.libtool import include_all

# logging.basicConfig(level=logging.DEBUG)
try:
    include_all(__file__, "server_base_packages")
except:
    include(get_executable_folder())


from djangoautoconf import DjangoAutoConf

root_folder = get_folder(__file__)

DjangoAutoConf.set_settings_env(root_folder)

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()


from django.conf import settings

# Password to use for web authentication
# c = get_config()
# c.NotebookApp.password = '******'
예제 #16
0
 def __init__(self):
     super(FrozenApp, self).__init__()
     self.root_folder = get_executable_folder()