diff --git a/zerver/lib/test_helpers.py b/zerver/lib/test_helpers.py index 7f3889dc59..7e6b4a4854 100644 --- a/zerver/lib/test_helpers.py +++ b/zerver/lib/test_helpers.py @@ -403,6 +403,7 @@ def write_instrumentation_reports(full_suite: bool, include_webhooks: bool) -> N 'node-coverage/(?P.*)', 'docs/(?P.*)', 'casper/(?P.*)', + 'static/(?P.*)', ] + [webhook.url for webhook in WEBHOOK_INTEGRATIONS if not include_webhooks]) untested_patterns -= exempt_patterns diff --git a/zerver/tests/test_docs.py b/zerver/tests/test_docs.py index bc5afadd7a..10cac64dbe 100644 --- a/zerver/tests/test_docs.py +++ b/zerver/tests/test_docs.py @@ -152,9 +152,6 @@ class DocPageTest(ZulipTestCase): self.assertEqual(result.status_code, 301) self.assertIn('hello', result['Location']) - result = self.client_get('/static/favicon.ico') - self.assertEqual(result.status_code, 200) - def test_portico_pages_open_graph_metadata(self) -> None: # Why Zulip url = '/why-zulip/' diff --git a/zproject/dev_urls.py b/zproject/dev_urls.py index 3825c1abbd..bd2139e4a6 100644 --- a/zproject/dev_urls.py +++ b/zproject/dev_urls.py @@ -1,5 +1,6 @@ from django.conf.urls import url from django.conf import settings +from django.contrib.staticfiles.urls import staticfiles_urlpatterns from django.views.generic import TemplateView import os from django.views.static import serve @@ -11,12 +12,8 @@ import zerver.views.development.integrations # These URLs are available only in the development environment use_prod_static = getattr(settings, 'PIPELINE_ENABLED', False) -static_root = os.path.join(settings.DEPLOY_ROOT, 'prod-static/serve' if use_prod_static else 'static') urls = [ - # Serve static assets via the Django server - url(r'^static/(?P.*)$', serve, {'document_root': static_root}), - # Serve useful development environment resources (docs, coverage reports, etc.) url(r'^coverage/(?P.*)$', serve, {'document_root': @@ -67,6 +64,14 @@ urls = [ zerver.views.development.integrations.get_fixtures), ] +# Serve static assets via the Django server +if use_prod_static: + urls += [ + url(r'^static/(?P.*)$', serve, {'document_root': settings.STATIC_ROOT}), + ] +else: + urls += staticfiles_urlpatterns() + i18n_urls = [ url(r'^confirmation_key/$', zerver.views.development.registration.confirmation_key), ]