Getting a dev installation of KA Lite running on OSX?

Hey there! I’m trying to install KA Lite (on macOS Sierra) following the instructions here but seem to be running into some issues.

I followed all of the instructions but found I also needed to do these two steps to get the pages to properly load:

$ npm install
$ kalite manage setup

Finally, running kalite manage runserver with the --settings=kalite.project.settings.dev flag then runs the server and everything loads!

However, I seem to be running into some performance issues with loading exercises. For example: loading one of the math pages like “Count with small numbers” takes a really long time. The page loads immediately but the actual exercise doesn’t show up for another 5-10 seconds. I don’t think I ran into these performance issues when I installed and ran KA Lite using the OSX dmg installer and starting the service from the app — are there app/project settings I can define to help increase performance, or am I missing any other installation steps?

Edit: Looks like the below is par for the course when running KA Lite in incognito mode. My guess is that the react code takes a while to compile/cache the front-end app, which it has to do on each page reload since incognito doesn’t cache anything. When I run this in a normal/non-incognito browser the first page load takes 6-10 seconds, and every subsequent reload is significantly faster (less than 1 second).

======

Some additional logging; looks like it takes about 7 seconds before the GET request to load the exercise kicks in:

[10/Jan/2017 15:16:42] "GET /api/topic_tree/khan?parent=cc-early-math-counting&_=1484090201103 HTTP/1.1" 200 281 [INFO] [2017-01-10 15:16:42,662] django.request: HTTP Request /api/content/khan/counting-out-1-20-objects/ - Response: 200 [10/Jan/2017 15:16:42] "GET /api/content/khan/counting-out-1-20-objects/?_=1484090201104 HTTP/1.1" 200 1280 [10/Jan/2017 15:16:49] "GET /static/js/distributed/bundles/bundle_exercise.js HTTP/1.1" 200 11338911 [INFO] [2017-01-10 15:16:52,130] django.request: HTTP Request /api/assessment_item/x9ef4ca7e914c87ec/ - Response: 200 [10/Jan/2017 15:16:52] "GET /api/assessment_item/x9ef4ca7e914c87ec/?_=1484090201105 HTTP/1.1" 200 576 [INFO] [2017-01-10 15:16:52,629] django.request: HTTP Request /images/throbber.gif - Response: 302

@jah

Thanks for your patience :slight_smile:

We have some old documentation floating around, sorry about that. If you can point me to where you found these dev instructions, I can get them updated.

  1. The best procedure is:

    # make and enable a virtual env
    # ...then install dependencies:
    pip install -r requirements_dev.txt
    # This compiles all necessary assets
    make assets
    # Setup database etc.
    bin/kalite manage setup
    
  2. Once initial has taken place, you can reuse this command, it rebuilds some JS assets at startup, so wait for this green status text to show up before loading it in the browser.
    bin/kalite manage runserver --settings=kalite.project.settings.dev

For example: loading one of the math pages like “Count with small
numbers” takes a really long time. The page loads immediately but the
actual exercise doesn’t show up for another 5-10 seconds.

This exercise is really problematic. I’ve tried profiling it, with no luck - it seems to be very slow compared to other exercises on upstream KA.org - I tried it some months back. However, now it has completely vanished within the past month or so… maybe they’ve decided too that it was problematic. @richard or @radina-matic do you recall this particular exercise being buggy?

The replacement looks very similar but has a different slug… IMO, it’s faster

Since the 0.17 content packs have just been rebuild, maybe @radina-matic knows if the exercise is updated…

Hey Benjamin, thanks for the reply! The instructions I took were strictly from the docs on this page though I assumed I had to add in those additional commands myself (npm install and kalite manage setup) due to missing node packages and missing database table errors.

I’ll try playing with some other exercises now that I know the one I was playing with was explicitly problematic. I’ll follow up if there’s any further issues on my end, thanks again!

Looks like this should actually be bin/kalite manage setup which will then prompt you to setup the database.

After doing a clean installation using the steps you mentioned, looks like everything is running SIGNIFICANTLY faster. Thanks a ton for the help on this!

True, edited my response.

I’m glad it helped! I’ll be revisiting the docs before releasing 0.17 so others shouldn’t encounter the same issues.