title: Django channels crashes whenever made a database call
body: <p>I have this code and I am making a database call in the <code>connect</code> method.
  The code runs fine if I comment the database call</p>
  <pre><code>async def connect(self):
      try:
          pk: int = self.scope['url_route']['kwargs']['pk']
          params: str = self.scope['query_string'].decode(&quot;utf-8&quot;)
          email: str = params.split('=')[1]
          # self.project: Project = await self.get_project(pk)
  
          self.room_name = &quot;Room name!&quot;
          self.room_group_name = 'chat_%s' % pk
  
          await self.channel_layer.group_add(
            self.room_group_name,
            self.channel_name
          )
          await self.accept()
      except Exception as e:
          print(e)
  
  @database_sync_to_async
  def get_project(self, pk: int) -&gt; Project:
    return Project.objects.filter(id=pk).first()
  </code></pre>
  <p>Can someone help me with this ? Thanks in advance</p>
  <p>Output:</p>
  <pre><code>Django version 3.2.5, using settings 'server.settings'       
  Starting ASGI/Channels version 3.0.3 development server at http://127.0.0.1:8000/
  Quit the server with CTRL-BREAK.
  WebSocket HANDSHAKING /chat/1 [127.0.0.1:60496]
  WebSocket DISCONNECT /chat/1 [127.0.0.1:60496]
  1006
  </code></pre>