diff --git a/InvenTree/InvenTree/apps.py b/InvenTree/InvenTree/apps.py
index 03eb2bcb60..148638b5b2 100644
--- a/InvenTree/InvenTree/apps.py
+++ b/InvenTree/InvenTree/apps.py
@@ -5,6 +5,7 @@ import logging
 from django.apps import AppConfig
 from django.core.exceptions import AppRegistryNotReady
 
+from InvenTree.ready import canAppAccessDatabase
 import InvenTree.tasks
 
 
@@ -16,7 +17,8 @@ class InvenTreeConfig(AppConfig):
 
     def ready(self):
 
-        self.start_background_tasks()
+        if canAppAccessDatabase():
+            self.start_background_tasks()
 
     def start_background_tasks(self):
 
diff --git a/InvenTree/InvenTree/ready.py b/InvenTree/InvenTree/ready.py
new file mode 100644
index 0000000000..7d4f2d4eb8
--- /dev/null
+++ b/InvenTree/InvenTree/ready.py
@@ -0,0 +1,24 @@
+import sys
+
+def canAppAccessDatabase():
+    """
+    Returns True if the apps.py file can access database records.
+
+    There are some circumstances where we don't want the ready function in apps.py
+    to touch the database:
+
+    - "flush" command
+    - "loaddata" command
+    - "migrate" command
+    """
+
+    if 'flush' in sys.argv:
+        return False
+    
+    if 'loaddata' in sys.argv:
+        return False
+
+    if 'migrate' in sys.argv:
+        return False
+
+    return True
diff --git a/InvenTree/company/apps.py b/InvenTree/company/apps.py
index 53e884c50f..4366f63434 100644
--- a/InvenTree/company/apps.py
+++ b/InvenTree/company/apps.py
@@ -3,11 +3,14 @@ from __future__ import unicode_literals
 import os
 import logging
 
+from PIL import UnidentifiedImageError
+
 from django.apps import AppConfig
 from django.db.utils import OperationalError, ProgrammingError
 from django.conf import settings
 
-from PIL import UnidentifiedImageError
+from InvenTree.ready import canAppAccessDatabase
+
 
 logger = logging.getLogger("inventree")
 
@@ -20,7 +23,8 @@ class CompanyConfig(AppConfig):
         This function is called whenever the Company app is loaded.
         """
 
-        self.generate_company_thumbs()
+        if canAppAccessDatabase():
+            self.generate_company_thumbs()
 
     def generate_company_thumbs(self):
 
diff --git a/InvenTree/label/apps.py b/InvenTree/label/apps.py
index c4ca408566..2b99921703 100644
--- a/InvenTree/label/apps.py
+++ b/InvenTree/label/apps.py
@@ -1,5 +1,4 @@
 import os
-import sys
 import shutil
 import logging
 import hashlib
@@ -7,6 +6,8 @@ import hashlib
 from django.apps import AppConfig
 from django.conf import settings
 
+from InvenTree.ready import canAppAccessDatabase
+
 
 logger = logging.getLogger("inventree")
 
@@ -33,14 +34,7 @@ class LabelConfig(AppConfig):
         This function is called whenever the label app is loaded
         """
 
-        if 'loaddata' in sys.argv:
-            """
-            In the case we are importing records,
-            do not automatically copy labels across.
-            This can cause database conflicts!
-            """
-            pass
-        else:
+        if canAppAccessDatabase():
             self.create_stock_item_labels()
             self.create_stock_location_labels()
 
diff --git a/InvenTree/part/apps.py b/InvenTree/part/apps.py
index 11329abdd9..531b74442a 100644
--- a/InvenTree/part/apps.py
+++ b/InvenTree/part/apps.py
@@ -9,6 +9,9 @@ from django.conf import settings
 
 from PIL import UnidentifiedImageError
 
+from InvenTree.ready import canAppAccessDatabase
+
+
 logger = logging.getLogger("inventree")
 
 
@@ -20,8 +23,9 @@ class PartConfig(AppConfig):
         This function is called whenever the Part app is loaded.
         """
 
-        self.generate_part_thumbnails()
-        self.update_trackable_status()
+        if canAppAccessDatabase():
+            self.generate_part_thumbnails()
+            self.update_trackable_status()
 
     def generate_part_thumbnails(self):
         """
diff --git a/InvenTree/report/apps.py b/InvenTree/report/apps.py
index 9709bb2309..43c52b1997 100644
--- a/InvenTree/report/apps.py
+++ b/InvenTree/report/apps.py
@@ -1,11 +1,12 @@
 import os
-import sys
 import shutil
 import logging
 
 from django.apps import AppConfig
 from django.conf import settings
 
+from InvenTree.ready import canAppAccessDatabase
+
 
 logger = logging.getLogger("inventree")
 
@@ -18,9 +19,7 @@ class ReportConfig(AppConfig):
         This function is called whenever the report app is loaded
         """
 
-        if 'loaddata' in sys.argv:
-            pass
-        else:
+        if canAppAccessDatabase():
             self.create_default_test_reports()
             self.create_default_build_reports()
 
diff --git a/InvenTree/users/apps.py b/InvenTree/users/apps.py
index 1541b1aed4..a9f671895d 100644
--- a/InvenTree/users/apps.py
+++ b/InvenTree/users/apps.py
@@ -5,21 +5,25 @@ from django.db.utils import OperationalError, ProgrammingError
 
 from django.apps import AppConfig
 
+from InvenTree.ready import canAppAccessDatabase
+
 
 class UsersConfig(AppConfig):
     name = 'users'
 
     def ready(self):
 
-        try:
-            self.assign_permissions()
-        except (OperationalError, ProgrammingError):
-            pass
+        if canAppAccessDatabase():
 
-        try:
-            self.update_owners()
-        except (OperationalError, ProgrammingError):
-            pass
+            try:
+                self.assign_permissions()
+            except (OperationalError, ProgrammingError):
+                pass
+
+            try:
+                self.update_owners()
+            except (OperationalError, ProgrammingError):
+                pass
 
     def assign_permissions(self):
 
diff --git a/InvenTree/users/models.py b/InvenTree/users/models.py
index 9a6908961b..cd222cb2a2 100644
--- a/InvenTree/users/models.py
+++ b/InvenTree/users/models.py
@@ -13,7 +13,8 @@ from django.dispatch import receiver
 from django.db.models.signals import post_save, post_delete
 
 import logging
-import sys
+
+from InvenTree.ready import canAppAccessDatabase
 
 
 logger = logging.getLogger("inventree")
@@ -271,12 +272,7 @@ def update_group_roles(group, debug=False):
 
     """
 
-    if 'loaddata' in sys.argv:
-        """
-        In the case that we are importing records,
-        *do not* update group roles:
-        This will cause conflicts in the database!
-        """
+    if not canAppAccessDatabase():
         return
 
     # List of permissions already associated with this group