Opened 15 years ago

Closed 9 years ago

#11495 closed Bug (wontfix)

Improvements to django.views.static.serve directory indexes

Reported by: Chris Beaven Owned by: Chris Beaven
Component: Core (Other) Version: dev
Severity: Normal Keywords: static
Cc: cmawebsite@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

Description

This patch sorts indexes and shows directories before files.
It also adds functionality for providing an index prefix so the template can show the full indexed path correctly.

Attachments (1)

11495.diff (3.4 KB ) - added by Chris Beaven 15 years ago.

Download all attachments as: .zip

Change History (21)

comment:1 by Chris Beaven, 15 years ago

Owner: changed from nobody to Chris Beaven
Status: newassigned

by Chris Beaven, 15 years ago

Attachment: 11495.diff added

comment:2 by George Vilches, 15 years ago

Being that the way a directory is sorted is an OS-specific choice, with *nix users getting solidly alphabetic sorting, and Windows users getting folder then file sorting, this should be an either/or option, not a unilateral change.

comment:3 by Alex Gaynor, 15 years ago

Triage Stage: UnreviewedAccepted

comment:4 by Chris Beaven, 15 years ago

Triage Stage: AcceptedDesign decision needed

My view is that it should be consistent no matter what OS is running the server. But pushing do a design decision.

comment:5 by Jannis Leidel, 14 years ago

milestone: 1.3
Triage Stage: Design decision neededAccepted

I agree with SmileyChris, this should be made consistent across the different OSs.

comment:6 by Eric Holscher, 14 years ago

Needs documentation: set
Needs tests: set

Seems like a good idea. However the new prefix needs to be documented, and this is a good candidate for testing, especially because it might vary across platforms.

comment:7 by Chris Beaven, 14 years ago

Summary: Small improvements to django.views.static.serve directory indexesImprovements to django.views.static.serve directory indexes

I've redone this for static-file awareness, patch can be found here:

https://github.com/SmileyChris/django/compare/master...11495-static-directory-indexes

comment:8 by Jannis Leidel, 14 years ago

milestone: 1.3
Triage Stage: AcceptedDesign decision needed

Hm, that branch goes a bit further than the ticket suggested, also listing all files/folders that the staticfiles finders find. IMO requires more discussion on -dev list.

comment:9 by Chris Beaven, 14 years ago

It does, since how indexes currently work with staticfiles now doesn't make a whole lot of sense.

I'm in agreement that it definitely requires more discussion.

comment:10 by Julien Phalip, 14 years ago

Severity: Normal
Type: Cleanup/optimization

comment:11 by Aymeric Augustin, 13 years ago

UI/UX: unset

Change UI/UX from NULL to False.

comment:12 by Aymeric Augustin, 13 years ago

Easy pickings: unset

Change Easy pickings from NULL to False.

comment:13 by Jannis Leidel, 12 years ago

Patch needs improvement: set

The branch isn't there anymore, any chance to update the patch here?

comment:14 by Chris Beaven, 12 years ago

I haven't looked at updating the branch, but it can be found here now (tied to the old django/django github repo):

https://github.com/SmileyChris/django-old/compare/master...11495-static-directory-indexes

comment:15 by Aymeric Augustin, 12 years ago

What is the use case for this?

comment:16 by Preston Holmes, 12 years ago

Triage Stage: Design decision neededAccepted
Type: Cleanup/optimizationBug
Version: 1.0master

Why should views.static.serve consider static file finders? As documented it is just a directory based tool.

I'd move to splitting this into two tickets. Accept this one which has the narrow scope of standardizing the sort order across OS versions for basic static.serve, I think this isn't too contentious.

The issue of how to incorporate static-file finders into index display can be sorted out separately, with its rationale and design proposal.

comment:17 by Collin Anderson, 10 years ago

Cc: cmawebsite@… added
Keywords: static added

I think we should deprecate and remove show_indexes completely. What do people use it for?

comment:18 by Tim Graham, 10 years ago

It seems show_indexes dates back to when the view was first added in 572ac3e7dfadec6434527ebbdccef97de1cc191c. I didn't see any mention in the ticket about why this functionality was needed. I guess it makes it a bit easier to debug if you have a typo in a file name or something (rather than opening up a file browser). Collin, can you present your rationale for deprecating it? No doubt some people like it and use it.

comment:19 by Collin Anderson, 10 years ago

My goal would be to start fully supporting using static.serve() (or something like it) in production (in 1.9), but we wouldn't want to support show_indexes in production.

Also, as mentioned, now that we have the staticfiles framework, this little feature is a lot harder to get right.

It seems to me, if you want a web index of files, you could just run python3 -m http.server 8080.

There's also this django-developers discussion: https://groups.google.com/d/topic/django-developers/N0KbgDeLuUE/discussion

comment:20 by Tim Graham, 9 years ago

Resolution: wontfix
Status: assignedclosed
Note: See TracTickets for help on using tickets.
Back to Top