from django.http import HttpResponse # IMPORT AT THE TOP HERE: This is completely safe! from apps.cloudmanager.models import Machine_Data,Schedule_Week_Data def coucou(request): # 1. Prepare the data inside the function data = CmmData( name="test", namespace="testspace", schedule_hour="1", schedule_day="deux", replicas=3 ) # 2. This line actually pushes the data into your cloudmanager_db! data.save() return HttpResponse('