Skip to content
Snippets Groups Projects
Commit 469c8e92 authored by Elke Kreim's avatar Elke Kreim
Browse files

Get app names from app config

parent 59ffb84d
Branches
Tags v2.2.22
No related merge requests found
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.conf import settings
from hshassets import utils from hshassets import utils
from hshassets import logger from hshassets import logger
...@@ -14,7 +13,7 @@ class Command(BaseCommand): ...@@ -14,7 +13,7 @@ class Command(BaseCommand):
app_name = options.get('app_name') app_name = options.get('app_name')
if app_name is None or app_name in settings.INSTALLED_APPS: if app_name is None or app_name in utils.get_installed_app_name_list():
logger.debug('\nStart build assets.\n') logger.debug('\nStart build assets.\n')
utils.build_assets(app_name) utils.build_assets(app_name)
logger.debug('Build assets finished!\n') logger.debug('Build assets finished!\n')
......
from django.core.management.base import BaseCommand from django.core.management.base import BaseCommand
from django.conf import settings
from hshassets import utils from hshassets import utils
from hshassets import logger from hshassets import logger
...@@ -28,7 +27,7 @@ class Command(BaseCommand): ...@@ -28,7 +27,7 @@ class Command(BaseCommand):
else: else:
empty = False empty = False
if app_name is None or app_name in settings.INSTALLED_APPS: if app_name is None or app_name in utils.get_installed_app_name_list():
logger.debug('\nStart initialize assets.\n') logger.debug('\nStart initialize assets.\n')
utils.init_assets(app_name, empty) utils.init_assets(app_name, empty)
logger.debug('Initialisation finished!\n') logger.debug('Initialisation finished!\n')
......
from django.conf import settings
from . import logger from . import logger
from importlib import import_module from importlib import import_module
...@@ -11,6 +8,13 @@ import jsmin ...@@ -11,6 +8,13 @@ import jsmin
import shutil import shutil
import re import re
from django.apps import apps as django_apps
from django.conf import settings
def get_installed_app_name_list():
return [app.name for app in django_apps.get_app_configs()]
def get_installed_apps_with_asset_directory(include_project=False): def get_installed_apps_with_asset_directory(include_project=False):
""" """
...@@ -19,9 +23,10 @@ def get_installed_apps_with_asset_directory(include_project=False): ...@@ -19,9 +23,10 @@ def get_installed_apps_with_asset_directory(include_project=False):
:return: list of appnames :return: list of appnames
""" """
apps = [] apps = []
for app_name in settings.INSTALLED_APPS:
for app_name in get_installed_app_name_list():
if os.path.isdir(get_assets_path(app_name)): if os.path.isdir(get_assets_path(app_name)):
if app_name is not 'hshassets': if app_name != 'hshassets':
apps.append(app_name) apps.append(app_name)
if not include_project and get_projectname() in apps: if not include_project and get_projectname() in apps:
apps.remove(get_projectname()) apps.remove(get_projectname())
......
...@@ -7,7 +7,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir))) ...@@ -7,7 +7,7 @@ os.chdir(os.path.normpath(os.path.join(os.path.abspath(__file__), os.pardir)))
setup( setup(
name='django-hshassets', name='django-hshassets',
version='2.2.21', version='2.2.22',
packages=find_packages(), packages=find_packages(),
include_package_data=True, include_package_data=True,
license='MIT License', license='MIT License',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment