Repository: learningequality/kolibri

Issue:
500 Internal Server Error on Content page (new dev repo) 
## Summary

This is a fresh development repo setup on Ubuntu 16.04.1 LTS 64-bit.
No content channels installed, Learn & Explore pages show `Download content channels from the Content Management page`, where the 500 error occurs:

![virtualbox_gnomeubuntu_14_10_2016_11_09_55](https://cloud.githubusercontent.com/assets/1457929/19384076/c00c7690-9207-11e6-9fab-01ee12e1465e.png)
## System information
- Version: dev repo
- Operating system: Ubuntu 16.04.1 LTS 64-bit
- Browser: Firefox
## Traceback or relevant snippet from server.log or browser console

Terminal is full of:

```
10:12:50 [Q] INFO Process-1:1:3 stopped pushing tasks
10:12:50 [Q] ERROR reincarnated pusher Process-1:1:3 after sudden death
10:12:50 [Q] INFO Process-1:1:4 pushing tasks at 3900
10:12:50 [Q] ERROR no such table: django_q_ormq
```



Discussion:
Error persists even after installing the testing channel with `kolibri manage importchannel` command:

```
[14/Oct/2016 10:31:55] "GET /learn/ HTTP/1.1" 200 14956
[14/Oct/2016 10:32:00] "GET /management/ HTTP/1.1" 200 6825
10:32:01 [Q] INFO Process-1:1:52 stopped pushing tasks
10:32:01 [Q] ERROR reincarnated pusher Process-1:1:52 after sudden death
10:32:01 [Q] INFO Process-1:1:53 pushing tasks at 4340
10:32:01 [Q] ERROR no such table: django_q_ormq
[14/Oct/2016 10:32:01] "GET /api/tasks/ HTTP/1.1" 500 153082
[14/Oct/2016 10:32:02] "GET /api/tasks/ HTTP/1.1" 500 153081
[14/Oct/2016 10:32:03] "GET /api/tasks/ HTTP/1.1" 500 153082
[14/Oct/2016 10:32:04] "GET /api/tasks/ HTTP/1.1" 500 153083
[14/Oct/2016 10:32:05] "GET /api/tasks/ HTTP/1.1" 500 153082
[14/Oct/2016 10:32:06] "GET /api/tasks/ HTTP/1.1" 500 153083
[14/Oct/2016 10:32:07] "GET /api/tasks/ HTTP/1.1" 500 153083
[14/Oct/2016 10:32:08] "GET /api/tasks/ HTTP/1.1" 500 153082
10:32:09 [Q] ERROR no such table: django_q_schedule
[14/Oct/2016 10:32:09] "GET /api/tasks/ HTTP/1.1" 500 153080
[14/Oct/2016 10:32:10] "GET /api/tasks/ HTTP/1.1" 500 153082
10:32:11 [Q] INFO Process-1:1:53 stopped pushing tasks
10:32:11 [Q] INFO Process-1:1:54 pushing tasks at 4352
10:32:11 [Q] ERROR no such table: django_q_ormq
10:32:11 [Q] ERROR reincarnated pusher Process-1:1:53 after sudden death
[14/Oct/2016 10:32:11] "GET /api/tasks/ HTTP/1.1" 500 153081
[14/Oct/2016 10:32:12] "GET /api/tasks/ HTTP/1.1" 500 153082
```

Ming, one of the interns, also encountered this issue. The solution here is to also run migrate on startup. Can make a pull request once I get to work. 

Thanks, @aronasorman, will test it out!


Resolving patch:
diff --git a/kolibri/core/webpack/management/commands/devserver.py b/kolibri/core/webpack/management/commands/devserver.py
--- a/kolibri/core/webpack/management/commands/devserver.py
+++ b/kolibri/core/webpack/management/commands/devserver.py
@@ -4,6 +4,7 @@
 import logging
 import multiprocessing
 import os
+import platform
 import subprocess
 import sys
 from threading import Thread
@@ -60,11 +61,14 @@ def handle(self, *args, **options):
         if options["karma"]:
             self.spawn_karma()
 
-        if options["qcluster"]:
+        if options["qcluster"] and platform.system() != "Windows":
             self.spawn_qcluster()
 
         update_channel_metadata_cache()
 
+        # migrate the ormq DB before starting.
+        call_command("migrate", interactive=False, database="ormq")
+
         return super(Command, self).handle(*args, **options)
 
     def spawn_webpack(self, lint):


Test patch: