django-pipeline icon indicating copy to clipboard operation
django-pipeline copied to clipboard

StaticLiveServerTestCase can not load static files

Open rightx2 opened this issue 8 years ago • 7 comments

I use selenium for the functional test. I also use django-pipeline for loading static fils. Problem is that selenium with StaticLiveServerTestCase(from django.contrib.staticfiles.testing import StaticLiveServerTestCase) could not load static files. ref : http://stackoverflow.com/questions/39762920/django-functional-test-selenium-live-server-url-doesnt-load-static-files

rightx2 avatar Sep 30 '16 02:09 rightx2

Same issue. @rightx2 did you find a workaround?

coilysiren avatar Dec 14 '16 22:12 coilysiren

Same here.

@rightx2 @lynnco do you have any news on this one?

mattions avatar Apr 10 '17 16:04 mattions

Same here. Is there any update for this?

hsiaoyi0504 avatar Mar 13 '18 16:03 hsiaoyi0504

I finally fixed my problem. I directly modified django.conf.settings.DEBUG directly, rather than using override_settings(DEBUD=True) before. After I changed to use override_settings(DEBUD=True), I fixed the problem.

I think it's not a issue of django-pipeline. I suspect that it's an internal change of django make the behavior of my tests not working anymore in 1.11. It does work in 1.8, though.

hsiaoyi0504 avatar Mar 13 '18 20:03 hsiaoyi0504

It may be related to https://code.djangoproject.com/ticket/29353, which was already fixed.

koxu1996 avatar Apr 26 '18 18:04 koxu1996

This is still broken

brianwawok avatar Aug 09 '18 02:08 brianwawok

I fixed this with:

  1. Extending LiveServerTestCase insead of StaticLiveServerTestCase
  2. Adding this to my test
    @classmethod
    def setUpClass(cls):
        super().setUpClass()
        call_command('collectstatic', '--noinput')

brianwawok avatar Aug 13 '18 18:08 brianwawok