def update(): """ Called whenever a version change in kolibri is detected TODO: We should look at version numbers of external plugins, too! """ # Can be removed once we stop calling update() from start() # See: https://github.com/learningequality/kolibri/issues/1615 if update.called: return update.called = True logger.info("Running update routines for new version...") # Need to do this here, before we run any Django management commands that # import settings. Otherwise the updated configuration will not be used # during this runtime. call_command("collectstatic", interactive=False) from kolibri.core.settings import SKIP_AUTO_DATABASE_MIGRATION if not SKIP_AUTO_DATABASE_MIGRATION: _migrate_databases() with open(version_file(), "w") as f: f.write(kolibri.__version__) from kolibri.content.utils.annotation import update_channel_metadata update_channel_metadata()
def start(port=8080): """ Starts the server. :param: port: Port number (default: 8080) """ # start the pingback thread PingbackThread.start_command() # Write the new PID with open(PID_FILE, 'w') as f: f.write("%d\n%d" % (os.getpid(), port)) # This should be run every time the server is started for now. # Events to trigger it are hard, because of copying a content folder into # ~/.kolibri, or deleting a channel DB on disk from kolibri.content.utils.annotation import update_channel_metadata update_channel_metadata() # This is also run every time the server is started to clear all the tasks # in the queue from kolibri.tasks.client import get_client get_client().clear(force=True) def rm_pid_file(): os.unlink(PID_FILE) atexit.register(rm_pid_file) run_server(port=port)
def handle(self, *args, **options): if options["webpack"]: self.spawn_webpack(lint=options["lint"]) if options["karma"]: self.spawn_karma() update_channel_metadata() return super(Command, self).handle(*args, **options)
def handle(self, *args, **options): if options["webpack"]: logging.warn( "This flag is deprecated and will be removed after the release of 0.10, please update your dev scripts." ) self.spawn_webpack() if options["karma"]: logging.warn( "This flag is deprecated and will be removed after the release of 0.10, please update your dev scripts." ) self.spawn_karma() update_channel_metadata() return super(Command, self).handle(*args, **options)