title: How can I test get request with curl on django?
body: <p>I am trying to test if a get request works but I am not sure how to do it in django.I have postgre database connected to django server and I am trying to test if I can get a GET request to work but I can't find nothing specific on the internet.</p>
  
  <p>I have some experience with Flask testing apis but not with Django.</p>
  
  <p>views.py</p>
  
  <pre><code>from django.contrib.auth.views import login_required
  from django.shortcuts import render
  from django.http import HttpResponse
  #from cameras.models import CameraQuerySet, Camera, CameraAuthenticationToken, CameraGroupQuerySet, CameraGroup, CameraStatusUpdate, CameraGroupLog
  from . import models #if not up
  
  
  @login_required
  def camera_lookup(request):
      serial_number = request.GET.get('serial_number')
      found = 0
      if serial_number != None:
          serial_number = serial_number.lower()
          found = Camera.objects.filter(serial_number=serial_number).count()
      return HttpResponse(str(found), content_type="text/html", status=200)
  
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code>from . import views
  from django.urls import path
  
  app_name = 'cameras'
  
  urlpatterns = [
      path('add/', views.add, name='add'),
      path(r'api/1.0/camera/', views.camera_lookup, name='camera_lookup'),
  
  </code></pre>
  
  <p>models.py</p>
  
  <pre><code>class Camera(TimeStampedModel):
      public_identifier = models.UUIDField(unique=True,
                                           default=uuid.uuid4,
                                           editable=False)
  
      serial_number = models.CharField(max_length=100,
                                       unique=True,
                                       null=True)
  
      name = models.CharField(max_length=50, blank=True, null=True)
  
      group = models.ForeignKey('CameraGroup',
                                on_delete=models.SET_NULL,
                                null=True,
                                related_name='cameras',
                                related_query_name='cameras')
  
      group_tracker = FieldTracker(fields=('group',))
  
      objects = CameraQuerySet.as_manager()
  
      #identifier from assembly (what parts does the camera consist of)
      bom                = models.CharField(max_length=50, blank=True, null=True)
  
      #what firmware is the camera on (mender artifact name)
      firmware           = models.CharField(max_length=50, blank=True, null=True)
  
      #last seen at ip
      last_sighting_ip   = models.CharField(max_length=50, blank=True, null=True)
      last_sighting_time = models.DateTimeField(null=True, blank=True)
  
      #json blob that the camera can send home w. health status
      health = models.TextField(blank=True)
  </code></pre>