Channels: ChannelsLiveServerTestCase doesn't load static files

Created on 5 Jul 2018  路  11Comments  路  Source: django/channels

This is the screenshot of the problem:
chrome-static-files

Development server works as intended:
chrome-devserver

That testing code you may found in this channels-examples fork.

$ pip freeze
aioredis==1.1.0
asgiref==2.3.2
async-timeout==3.0.0
atomicwrites==1.1.5
attrs==18.1.0
autobahn==18.6.1
Automat==0.7.0
channels==2.1.2
channels-redis==2.2.1
constantly==15.1.0
daphne==2.2.0
Django==2.0.7
hiredis==0.2.0
hyperlink==18.0.0
idna==2.7
incremental==17.5.0
more-itertools==4.2.0
msgpack==0.5.6
pluggy==0.6.0
psycopg2-binary==2.7.5
py==1.5.4
pytest==3.6.3
pytest-asyncio==0.8.0
pytest-django==3.3.2
pytz==2018.5
selenium==3.13.0
six==1.11.0
Twisted==18.4.0
txaio==2.10.0
zope.interface==4.5.0

I'm afraid I can't locate commit in time as this solved bug would emerge.

blockeneeds-investigation bug exintermediate

All 11 comments

Are you running your tests with DEBUG=False? That would disable Django's built-in static file serving.

Also - is this behaviour different if you don't have channels installed?

Are you running your tests with DEBUG=False? That would disable Django's built-in static file serving.

Nope. I override nothing during tests and in settings it's DEBUG = True.

Also - is this behaviour different if you don't have channels installed?

I'm subclassing ChannelsLiveServerTestCase so it's not applicable I'm afraid.

All my other tests are doing fine and this misbehavior hadn't existed before - all the static files had been loaded and I could successfully test. Iirc this problem emerged somewhere after 2.0.1 version.

Any chance you could narrow down the release/commit it actually occurs in? That would let me find the source much easier with the limited time I have to work on each issue!

II'm afraid I can't get it work. :(

I downgraded all the major packages and changed the code if needed, like channels==2.0.0, asgiref==2.2.0, daphne==2.0.1, pytest==3.0.6, pytest-django==3.0.0 and it doesn't load the CSS.

And I'm sure it had been worked somewhere way ahead channels 2 version, iirc in March, but now I can't set it to work.

Hmm. I have seen static files working in live server tests myself when I was debugging them a couple of months ago, but I don't have the spare time at the moment to go try that again - knowing roughly where the failure happened really helps. Does it happen on a brand new project too?

Yes, I followed the instructions from the readthedocs' tutorial and it doesn't load css.

Have you tried a different machine, maybe it's that?

I'm afraid I won't have time to look at this and reproduce it for a month or two with my current schedule and all the other bugs, so I'm trying to help you discover what's happening. Maybe someone else ca help too.

I just cloned my channels-examples repo to a VirtualBox machine with Ubuntu and it's the same.

OK, it might be a fundamental problem in the static file server then I guess? I'll try to get to this at some point.

It appears that static functionality was deleted in commit 15f8b7d44362537d9cbc3fe16b91092b9bf6c6c5 as part of related Issue #897, and Pull Request #934.

Ah yes, that would have been it, so the code to add the static serving needs to be added back in then.

Was this page helpful?
0 / 5 - 0 ratings