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

Add management command initassets, review utils

parent ed0e748f
No related branches found
No related tags found
No related merge requests found
from .defaults import *
from .logging import *
from django import conf
# merge defaults with customized user settings
for setting_name in [k for k in globals().keys() if k.isupper()]:
......
import logging.config
LOGGING_CONFIG = None
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
},
},
'formatters': {
'with_timestamp': {
'format': '[%(asctime)s %(levelname)s %(thread)d] %(message)s',
'datefmt': '%Y-%m-%d %H:%M:%S',
},
'without_timestamp': {
'format': '%(name)s %(levelname)s: %(message)s',
}
},
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'with_timestamp'
},
'null': {
'class': 'logging.NullHandler',
},
'console_without_timestamp': {
'level': 'INFO',
'class': 'logging.StreamHandler',
'formatter': 'without_timestamp'
}
},
'loggers': {
'': {
'handlers': ['console'],
'level': 'INFO'
},
'django': {
'level': 'WARNING',
'handlers': ['console'],
'propagate': False,
},
'django.db': {
'level': 'INFO',
'handlers': ['console'],
'propagate': False,
},
'django.request': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'django.server': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'django.security': {
'handlers': ['console'],
'level': 'WARNING',
'propagate': False,
},
'django.template': {
'handlers': ['console'],
'level': 'INFO',
'propagate': False,
},
'hshassets': {
'handlers': ['console_without_timestamp', ],
'level': 'INFO',
'propagate': False,
},
}
}
logging.config.dictConfig(LOGGING)
......@@ -38,13 +38,13 @@ $custom-colors: ($hsh-colors);
// COLOR SCHEME FOR CORPORATE DESIGN
// by default service will be used, if you need another one comment and uncomment approprate
//@import "cd/f1.scss";
//@import "cd/f2.scss";
//@import "cd/f3.scss";
//@import "cd/f4.scss";
//@import "cd/f5.scss";
@import "cd/service.scss"; // default color scheme for hshassets
//@import "cd/zsw.scss";
//@import "cd/f1";
//@import "cd/f2";
//@import "cd/f3";
//@import "cd/f4";
//@import "cd/f5";
@import "cd/service"; // default color scheme for hshassets
//@import "cd/zsw";
@import "lib/bulma-0.7.2/sass/utilities/derived-variables";
......@@ -151,4 +151,4 @@ $panel-block-hover-background-color: $cd-link-hover;
// import customized hshstyle
@import "corporate_design";
@import "hshstyles.scss";
\ No newline at end of file
@import "hshstyles";
\ No newline at end of file
from django.core.management.base import BaseCommand
from django.conf import settings
from hshassets import utils
from importlib import import_module
import os
import sass
import jsmin
class Command(BaseCommand):
help = 'Builds the projects assets'
def handle(self, *args, **options):
verbose = bool(options.get('verbosity', 0))
print('\nStart generating styles ...\n')
utils.do_everything(verbose=verbose)
print('Everything finished! \033[92m(ಠ‿↼)\033[0m\n')
utils.build_assets()
from django.core.management.base import BaseCommand
from django.conf import settings
from hshassets import utils
from hshassets import logger
class Command(BaseCommand):
help = 'Initializes the projects assets by creating an assets directory and copying scss file'
def add_arguments(self, parser):
parser.add_argument('app_name', nargs='?', type=str)
parser.add_argument(
'-e',
'--empty',
action="store_true",
dest='empty',
help='Create an empty _init.scss file and directories',
)
def handle(self, *args, **options):
app_name = options.get('app_name')
if options['empty']:
empty=True
else:
empty=False
if app_name is None or app_name in settings.INSTALLED_APPS:
logger.debug('\nStart initalise assets.\n')
utils.init_assets(app_name, empty)
logger.debug('Initialisation finished!\n')
else:
logger.info('The name is not found in installed apps of your project, no initialisation possible.')
if options['empty']:
pass
\ No newline at end of file
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment