<s> import logging , logging . handlers <EOL> from django . core . management . base import NoArgsCommand <EOL> from django . core . management import call_command <EOL> from ... router import router <EOL> from ... conf import settings <EOL> class Command ( NoArgsCommand ) : <EOL> help = "<STR_LIT>" % settings . PROJECT_NAME <EOL> def handle_noargs ( self , ** options ) : <EOL> numeric_level = getattr ( logging , settings . LOG_LEVEL . upper ( ) ) <EOL> format = logging . Formatter ( settings . LOG_FORMAT ) <EOL> router . logger = logging . getLogger ( ) <EOL> router . logger . setLevel ( numeric_level ) <EOL> handler = logging . StreamHandler ( ) <EOL> router . logger . addHandler ( handler ) <EOL> handler . setLevel ( numeric_level ) <EOL> handler . setFormatter ( format ) <EOL> file_handler = logging . handlers . RotatingFileHandler ( <EOL> settings . LOG_FILE , maxBytes = settings . LOG_SIZE , <EOL> backupCount = settings . LOG_BACKUPS ) <EOL> router . logger . addHandler ( file_handler ) <EOL> file_handler . setFormatter ( format ) <EOL> call_command ( "<STR_LIT>" , verbosity = <NUM_LIT:0> ) <EOL> call_command ( "<STR_LIT>" , verbosity = <NUM_LIT:0> ) <EOL> for name in settings . INSTALLED_APPS : <EOL> router . add_app ( name ) <EOL> for name , conf in settings . INSTALLED_BACKENDS . items ( ) : <EOL> router . add_backend ( name , conf . pop ( "<STR_LIT>" ) , conf ) <EOL> router . start ( ) </s>
