-
Notifications
You must be signed in to change notification settings - Fork 152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static files not served in StaticLiveServerTestCase? #86
Comments
Does the issue still exist when using the native Django storage backend (WhiteNoise's backend is only a thin wrapper around it)? |
Thanks for the prompt response. I tried this, but in doing so realised my problem wasn't really with Whitenoise or Heroku, but actually with getting my tests to run on CircleCI. I added the below to my circle.yml file and all is well.
|
Ah yes that would do it :-) I almost asked whether collectstatic had been run, but I read the issue description as meaning Heroku was affected too, and collectstatic is run there automatically (courtesy of this script). Thank you for updating the ticket! |
It could be worth updating the docs... I just ran into this issue on circleci too... |
Which docs? It actually feels like something which belongs on CircleCI docs: "Don't forget to add collecstatic if you run Django client tests" |
I've run into this problem too now, and it seems like a non-optimal workaround. Why is it working any differently on CircleCI than on my development environment? Shouldn't tests run in an environment where whitenoise pulls the static files out of their source directories not their collected destination? |
@lisad Your tests must be running with It's up to you how you want to run your tests, however most people do so with debug-mode disabled so as to better replicate the production environment. |
Fair point @evansd. I suppose putting 'collectstatic' in there before the test run serves to test that the static files will be there in production as expected. |
I'm developing a Django application with Heroku deployment. I am trying to round out test coverage with some django.test.Client get requests within a StaticLiveServerTestCase. These run fine locally, and files are served fine on the actual site, but my test fails on CircleCI / Heroku:
... ... File "/home/ubuntu/virtualenvs/venv-3.5.0/lib/python3.5/site-packages/django/contrib/staticfiles/storage.py", line 94, in hashed_name (clean_name, self)) ValueError: The file 'search/css/bootstrap.min.css' could not be found with <whitenoise.django.GzipManifestStaticFilesStorage object at 0x7f65c2a60be0>.
Not a serious blocker, but would welcome any suggestions!
The text was updated successfully, but these errors were encountered: