Web-Developer's Project Template Directory

后端 未结 11 1277
予麋鹿
予麋鹿 2021-01-30 03:18

IMPORTANT: The accepted answer was accepted post-bounty, not necessarily because I felt it was the best answer.


I find myself doing things over an

11条回答
  •  滥情空心
    2021-01-30 04:10

    I use a similar layout, but with one major exception: all of these directories live under a top-level media/ directory. This is for a few reasons:

    1. This directory is rsync'd to two other servers which handle all of the static media requests.
    2. Having multiple hosts allows some browsers to make more parallel requests for support files.
    3. The media/ directory has its own .htaccess file which strips off a psuedo directory from the path which is the date-time last modified of the image (or whatever).

    A custom template tag (I have used this with 2 Django projects, but you could do it in PHP, etc.) generates urls which a) semi-randomly choose one of the media servers, b) add the time-based pseudo directory to the path, and c) give the object an Expires time of now + 10 years.

提交回复
热议问题