diff --git a/smash/web/importer/csv_tns_visit_import_reader.py b/smash/web/importer/csv_tns_visit_import_reader.py
index 7383f39323b18d96232575e41304608b4183fad2..2669ad51342b94fbffc5e311248b2f61a4b00314 100644
--- a/smash/web/importer/csv_tns_visit_import_reader.py
+++ b/smash/web/importer/csv_tns_visit_import_reader.py
@@ -7,11 +7,10 @@ import sys
 import traceback
 
 import pytz
-from django.conf import settings
 
 from web.models import StudySubject, Study, Visit, Appointment, AppointmentType, Location, AppointmentTypeLink, Subject, \
     User, Worker, Provenance, ConfigurationItem
-from web.models.constants import GLOBAL_STUDY_ID, IMPORTER_USER
+from web.models.constants import GLOBAL_STUDY_ID, IMPORTER_USER, IMPORT_APPOINTMENT_TYPE
 from .warning_counter import MsgCounterHandler
 
 CSV_DATE_FORMAT = "%d/%m/%Y"
@@ -22,13 +21,13 @@ logger = logging.getLogger(__name__)
 class TnsCsvVisitImportReader:
     def __init__(self):
         self.study = Study.objects.filter(id=GLOBAL_STUDY_ID)[0]
-        appointment_code = getattr(settings, "IMPORT_APPOINTMENT_TYPE", "SAMPLES")
+        appointment_code = ConfigurationItem.objects.get(type=IMPORT_APPOINTMENT_TYPE).value
 
         appointment_types = AppointmentType.objects.filter(code=appointment_code)
         if len(appointment_types) > 0:
             self.appointment_type = appointment_types[0]
         else:
-            logger.warn("Appointment type does not exist: " + appointment_code)
+            logger.warning("Appointment type does not exist: " + appointment_code)
             self.appointment_type = None
         self.problematic_count = 0
         self.processed_count = 0
diff --git a/smash/web/migrations/0176_configurationitem_local_setting_clean.py b/smash/web/migrations/0176_configurationitem_local_setting_clean.py
index 4f7c28ed7c55f41f9b14a99c72c5db1e38ca2647..8b50a7abc90eb98a0d33c2dc40cd32d7e2469bbb 100644
--- a/smash/web/migrations/0176_configurationitem_local_setting_clean.py
+++ b/smash/web/migrations/0176_configurationitem_local_setting_clean.py
@@ -3,8 +3,8 @@ from django.conf import settings
 from django.db import migrations
 
 from web.models.constants import DEFAULT_FROM_EMAIL, DAILY_SUBJECT_IMPORT_FILE, DAILY_SUBJECT_EXPORT_FILE, \
-    DAILY_VISIT_IMPORT_FILE, DAILY_VISIT_EXPORT_FILE, SUBJECT_IMPORT_RUN_AT, SUBJECT_EXPORT_RUN_AT, VISIT_EXPORT_RUN_AT, \
-    VISIT_IMPORT_RUN_AT, IMPORTER_USER
+    DAILY_VISIT_IMPORT_FILE, DAILY_VISIT_EXPORT_FILE, SUBJECT_IMPORT_RUN_AT, SUBJECT_EXPORT_RUN_AT, \
+    VISIT_EXPORT_RUN_AT, VISIT_IMPORT_RUN_AT, IMPORTER_USER, IMPORT_APPOINTMENT_TYPE
 
 
 def create_item(apps, item_type, value, name):
@@ -56,6 +56,10 @@ def configuration_items(apps, schema_editor):
     create_item(apps, IMPORTER_USER, importer_user_name,
                 "User that should be assigned to changes introduced by importer")
 
+    appointment_code = getattr(settings, "IMPORT_APPOINTMENT_TYPE", "SAMPLES")
+    create_item(apps, IMPORT_APPOINTMENT_TYPE, appointment_code,
+                "Type of appointment assigned to imported visits")
+
 
 class Migration(migrations.Migration):
     dependencies = [
diff --git a/smash/web/models/constants.py b/smash/web/models/constants.py
index 70502072c4ca26629c4390f891e340f22f5a2a3d..7bff23a6e9f89914a7614b833513208e3e87b38e 100644
--- a/smash/web/models/constants.py
+++ b/smash/web/models/constants.py
@@ -65,7 +65,8 @@ SUBJECT_IMPORT_RUN_AT = "SUBJECT_IMPORT_RUN_AT"
 SUBJECT_EXPORT_RUN_AT = "SUBJECT_EXPORT_RUN_AT"
 VISIT_EXPORT_RUN_AT = "VISIT_EXPORT_RUN_AT"
 VISIT_IMPORT_RUN_AT = "VISIT_IMPORT_RUN_AT"
-IMPORTER_USER ="IMPORTER_USER"
+IMPORTER_USER = "IMPORTER_USER"
+IMPORT_APPOINTMENT_TYPE = "IMPORT_APPOINTMENT_TYPE"
 
 RED_CAP_LANGUAGE_4_FIELD_TYPE = 'RED_CAP_LANGUAGE_4_FIELD_TYPE'
 RED_CAP_LANGUAGE_3_FIELD_TYPE = 'RED_CAP_LANGUAGE_3_FIELD_TYPE'
diff --git a/smash/web/redcap_connector.py b/smash/web/redcap_connector.py
index 886dadfbf3774fbade640545744db56343a2edba..ef62c8bfabd6f7dfbc6ccca165285fcade332571 100644
--- a/smash/web/redcap_connector.py
+++ b/smash/web/redcap_connector.py
@@ -7,7 +7,6 @@ import logging
 import certifi
 import pycurl
 import timeout_decorator
-from django.conf import settings
 from django.forms.models import model_to_dict
 from django_cron import CronJobBase, Schedule
 
@@ -20,7 +19,7 @@ from web.models.constants import REDCAP_TOKEN_CONFIGURATION_TYPE, \
     RED_CAP_LANGUAGE_2_FIELD_TYPE, RED_CAP_LANGUAGE_1_FIELD_TYPE, RED_CAP_MPOWER_ID_FIELD_TYPE, RED_CAP_DEAD_FIELD_TYPE, \
     RED_CAP_SEX_FIELD_TYPE, RED_CAP_DATE_BORN_FIELD_TYPE, RED_CAP_ND_NUMBER_FIELD_TYPE, RED_CAP_VIRUS_FIELD_TYPE, \
     GLOBAL_STUDY_ID, RED_CAP_SAMPLE_DATE_FIELD_TYPE, RED_CAP_KIT_ID_FIELD_TYPE, RED_CAP_IGA_STATUS_FIELD_TYPE, \
-    RED_CAP_IGG_STATUS_FIELD_TYPE, IMPORTER_USER
+    RED_CAP_IGG_STATUS_FIELD_TYPE, IMPORTER_USER, IMPORT_APPOINTMENT_TYPE
 from web.models.inconsistent_subject import InconsistentField, InconsistentSubject
 from web.models.missing_subject import MissingSubject
 
@@ -196,7 +195,7 @@ class RedcapConnector(object):
         self.add_inconsistent(inconsistent)
 
     def find_inconsistent(self):
-        appointment_type_code_to_finish = getattr(settings, "IMPORT_APPOINTMENT_TYPE", None)
+        appointment_type_code_to_finish = ConfigurationItem.objects.get(type=IMPORT_APPOINTMENT_TYPE).value
         appointment_type_to_finish = None
         if appointment_type_code_to_finish is not None:
             appointment_types = AppointmentType.objects.filter(code=appointment_type_code_to_finish)
diff --git a/smash/web/tests/importer/test_tns_csv_visit_import_reader.py b/smash/web/tests/importer/test_tns_csv_visit_import_reader.py
index 24be480239b0b8aecad4299bfc3888e11f443bde..426062309561c45b172a29e8d45489da199a3cc4 100644
--- a/smash/web/tests/importer/test_tns_csv_visit_import_reader.py
+++ b/smash/web/tests/importer/test_tns_csv_visit_import_reader.py
@@ -4,11 +4,11 @@ import logging
 from datetime import datetime
 
 import pytz
-from django.conf import settings
 from django.test import TestCase
 
 from web.importer import TnsCsvVisitImportReader, MsgCounterHandler
-from web.models import Appointment, Visit, StudySubject, AppointmentTypeLink, AppointmentType
+from web.models import Appointment, Visit, StudySubject, AppointmentTypeLink, AppointmentType, ConfigurationItem
+from web.models.constants import IMPORT_APPOINTMENT_TYPE
 from web.tests.functions import get_resource_path, create_study_subject, create_appointment_type, create_location
 
 logger = logging.getLogger(__name__)
@@ -18,7 +18,10 @@ class TestTnsCsvVisitReader(TestCase):
     def setUp(self):
         self.warning_counter = MsgCounterHandler()
         logging.getLogger('').addHandler(self.warning_counter)
-        setattr(settings, "IMPORT_APPOINTMENT_TYPE", "SAMPLE_2")
+
+        item = ConfigurationItem.objects.get(type=IMPORT_APPOINTMENT_TYPE)
+        item.value = "SAMPLE_2"
+        item.save()
         create_appointment_type(code="SAMPLE_2")
 
         create_study_subject(nd_number='cov-000111')
@@ -30,7 +33,6 @@ class TestTnsCsvVisitReader(TestCase):
         create_location(name="Ketterthill	1-3, rue de la Continentale 	4917	Bascharage")
 
     def tearDown(self):
-        setattr(settings, "IMPORT_APPOINTMENT_TYPE", None)
         logging.getLogger('').removeHandler(self.warning_counter)
 
     def test_load_data(self):