<s> """<STR_LIT>""" <EOL> import os <EOL> import shutil <EOL> from django . core . management . base import BaseCommand <EOL> from django . conf import settings <EOL> from tethys_apps . helpers import get_installed_tethys_apps <EOL> class Command ( BaseCommand ) : <EOL> """<STR_LIT>""" <EOL> def handle ( self , * args , ** options ) : <EOL> """<STR_LIT>""" <EOL> if not settings . STATIC_ROOT : <EOL> print ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> exit ( <NUM_LIT:1> ) <EOL> static_root = settings . STATIC_ROOT <EOL> installed_apps = get_installed_tethys_apps ( ) <EOL> print ( '<STR_LIT>' . format ( static_root ) ) <EOL> for app , path in installed_apps . iteritems ( ) : <EOL> public_path = os . path . join ( path , '<STR_LIT>' ) <EOL> static_path = os . path . join ( path , '<STR_LIT>' ) <EOL> static_root_path = os . path . join ( static_root , app ) <EOL> try : <EOL> os . remove ( static_root_path ) <EOL> except OSError : <EOL> try : <EOL> shutil . rmtree ( static_root_path ) <EOL> except OSError : <EOL> pass <EOL> if os . path . isdir ( public_path ) : <EOL> os . symlink ( public_path , static_root_path ) <EOL> print ( '<STR_LIT>' . format ( app ) ) <EOL> elif os . path . isdir ( static_path ) : <EOL> os . symlink ( static_path , static_root_path ) <EOL> print ( '<STR_LIT>' . format ( app ) ) </s>
