channels: Running ChannelsLiveServerTestCase does not create database for browser

Using ChannelsLiveServerTestCase as described in documentation’s Tutorial Part 4: Automated Testing yields the yellow error page connection to server at "127.0.0.1", port 5432 failed: FATAL: database "test" does not exist. Running database-altering code within a test function works and the database is available, but the frontend worker serving the browser request (using Daphne) seems to be totally detached from that database. Somehow the asgiref workers are working in another thread?

I created a small test repository with a small readme to reproduce the issue: https://github.com/alfonsrv/django-asgitest

Tried using macOS Ventura + Ubuntu 22.04 with Chrome.

About this issue

  • Original URL
  • State: open
  • Created 10 months ago
  • Comments: 21 (11 by maintainers)

Most upvoted comments

Ok, thanks. I will try and have a look, and perhaps expand the tutorial example to show interactions with the DB.