[Django] #19295: runserver --insecure doesn't work with DEBUG False and CachedStaticFilesStorage

140 views
Skip to first unread message

Django

unread,
Nov 14, 2012, 3:46:09 PM11/14/12
to django-...@googlegroups.com
#19295: runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
-------------------------------------+--------------------
Reporter: Apreche | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.4
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+--------------------
How to reproduce:

Enable the CachedStaticFilesStorage in your settings and turn DEBUG off.

{{{
DEBUG = False

STATICFILES_STORAGE =
'django.contrib.staticfiles.storage.CachedStaticFilesStorage'
}}}

Turn on the runserver with the insecure flag

{{{ $ python manage.py runserver --insecure }}}

Visit your runserver in your browser, and the static files will not load.
When using the default
django.contrib.staticfiles.storage.StaticFilesStorage the static files
will load.

The reason is because of this section in contrib/staticfiles.storage.py

{{{
100 def url(self, name, force=false):
101 """
102 Returns the real URL in DEBUG mode.
103 """
104 if settings.DEBUG and not force:
105 hashed_name, fragment = name, ''
106 else:
}}}

When DEBUG is False, the automatic static file serving in runserver is
disabled. But using runserver with --insecure will re-enable it. Because
the CachedStaticFilesStorage only looks at the DEBUG flag, it will not
work properly in this scenario. Perhaps that force parameter could be set
to True when the --insecure flag is passed to runserver?

Yes, this is an extremely rare and low-priority edge case, but still a
bug.

It's also not clear what the expected behavior is when both the --nostatic
and --insecure flags are passed to runserver simultaneously. They sort of
cancel each other out. Personally I feel the nostatic should take
priority.

--
Ticket URL: <https://code.djangoproject.com/ticket/19295>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 14, 2012, 8:41:55 PM11/14/12
to django-...@googlegroups.com
#19295: runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: nobody
Type: Bug | Status: closed
Component: contrib.staticfiles | Version: 1.4
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by anonymous):

* status: new => closed
* needs_better_patch: => 0
* resolution: => fixed
* needs_tests: => 0
* needs_docs: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:1>

Django

unread,
Nov 14, 2012, 8:42:16 PM11/14/12
to django-...@googlegroups.com
#19295: runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: nobody
Type: Bug | Status: reopened
Component: contrib.staticfiles | Version: 1.4
Severity: Normal | Resolution:

Keywords: | Triage Stage:
Has patch: 0 | Unreviewed
Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by anonymous):

* status: closed => reopened
* resolution: fixed =>


--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:2>

Django

unread,
Nov 16, 2012, 3:59:06 PM11/16/12
to django-...@googlegroups.com
#19295: runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
-------------------------------------+-------------------------------------

Reporter: Apreche | Owner: nobody
Type: Bug | Status: new
Component: contrib.staticfiles | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Design
Has patch: 0 | decision needed

Needs tests: 0 | Needs documentation: 0
Easy pickings: 0 | Patch needs improvement: 0
| UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by aaugustin):

* needs_better_patch: => 0
* stage: Unreviewed => Design decision needed


* needs_tests: => 0
* needs_docs: => 0


Comment:

I can reproduce the issue, but I don't know how to fix it.

--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:1>

Django

unread,
Nov 22, 2012, 4:02:02 AM11/22/12
to django-...@googlegroups.com
#19295: runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
--------------------------------------+------------------------------------
Reporter: Apreche | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: contrib.staticfiles | Version: 1.4
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by jezdez):

* type: Bug => Cleanup/optimization
* stage: Design decision needed => Accepted


Comment:

I'm pretty sure you're way out of scope for both runserver and the
CachedStaticFilesStorage. So to answer your question, to fix this "bug"
stop using --insecure in the first place.

I'm accepting this ticket to warn users in the docs that both modes are
incompatible.

--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:2>

Django

unread,
Jul 16, 2013, 6:45:51 AM7/16/13
to django-...@googlegroups.com
#19295: Document that runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
--------------------------------------+------------------------------------
Reporter: Apreche | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Documentation | Version: 1.4

Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
--------------------------------------+------------------------------------
Changes (by timo):

* component: contrib.staticfiles => Documentation
* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:3>

Django

unread,
Sep 6, 2013, 1:19:33 PM9/6/13
to django-...@googlegroups.com
#19295: Document that runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: kedmiston
Type: | Status: assigned
Cleanup/optimization | Version: 1.4
Component: Documentation | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by kedmiston):

* owner: nobody => kedmiston
* status: new => assigned


--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:4>

Django

unread,
Sep 6, 2013, 5:28:51 PM9/6/13
to django-...@googlegroups.com
#19295: Document that runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage

-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: kedmiston
Type: | Status: closed
Cleanup/optimization | Version: 1.4
Component: Documentation | Resolution: fixed

Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"028db9750357d504c55a7ac686c9abaa3c847ac6"]:
{{{
#!CommitTicketReference repository=""
revision="028db9750357d504c55a7ac686c9abaa3c847ac6"
Fixed #19295 -- Documented that CachedStaticFilesStorage isn't compatible
with runserver --insecure.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:5>

Django

unread,
Sep 6, 2013, 5:31:14 PM9/6/13
to django-...@googlegroups.com
#19295: Document that runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage

-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: kedmiston
Type: | Status: closed
Cleanup/optimization | Version: 1.4
Component: Documentation | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"afc624cab015be3c05dbe2c184416c4838db4b82"]:
{{{
#!CommitTicketReference repository=""
revision="afc624cab015be3c05dbe2c184416c4838db4b82"
[1.5.x] Fixed #19295 -- Documented that CachedStaticFilesStorage isn't
compatible with runserver --insecure.

Backport of 028db97503 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:6>

Django

unread,
Sep 6, 2013, 5:31:15 PM9/6/13
to django-...@googlegroups.com
#19295: Document that runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage

-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: kedmiston
Type: | Status: closed
Cleanup/optimization | Version: 1.4
Component: Documentation | Resolution: fixed
Severity: Normal | Triage Stage: Accepted
Keywords: | Needs documentation: 0
Has patch: 0 | Patch needs improvement: 0
Needs tests: 0 | UI/UX: 0
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"2c73ba88f25230e9e62293d25de7526d018041e8"]:
{{{
#!CommitTicketReference repository=""
revision="2c73ba88f25230e9e62293d25de7526d018041e8"
[1.6.x] Fixed #19295 -- Documented that CachedStaticFilesStorage isn't
compatible with runserver --insecure.

Backport of 028db97503 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:7>

Django

unread,
Oct 18, 2017, 9:10:21 PM10/18/17
to django-...@googlegroups.com
#19295: Document that runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage
-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: Keith
Type: | Edmiston
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.4
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"4a861e88508eacdb8d0d5bc43f9a0576cedb9f22" 4a861e88]:
{{{
#!CommitTicketReference repository=""
revision="4a861e88508eacdb8d0d5bc43f9a0576cedb9f22"
Refs #19295 -- Doc'd that ManifestStaticFilesStorage doesn't work with
runserver --insecure.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:8>

Django

unread,
Oct 18, 2017, 9:10:35 PM10/18/17
to django-...@googlegroups.com
#19295: Document that runserver --insecure doesn't work with DEBUG False and
CachedStaticFilesStorage

-------------------------------------+-------------------------------------
Reporter: Apreche | Owner: Keith
Type: | Edmiston
Cleanup/optimization | Status: closed
Component: Documentation | Version: 1.4
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"36b4def91597d522fa73f9b3cb7d0530fe34bc62" 36b4def9]:
{{{
#!CommitTicketReference repository=""
revision="36b4def91597d522fa73f9b3cb7d0530fe34bc62"
[2.0.x] Refs #19295 -- Doc'd that ManifestStaticFilesStorage doesn't work
with runserver --insecure.

Backport of 4a861e88508eacdb8d0d5bc43f9a0576cedb9f22 from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/19295#comment:9>

Reply all
Reply to author
Forward
0 new messages