Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#15344 closed (worksforme)

STATIC_ROOT is not considered when serving static files with staticfiles_urlpatterns

Reported by: carlopires Owned by: nobody
Component: Uncategorized Version: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

As django.contrib.staticfiles.finders.FileSystemFinder blocks settings.STATIC_ROOT to be on
settings.STATICFILES_DIR, django.contrib.staticfiles.finders.find() should consider settings.STATIC_ROOT on lookup for static files.

Change History (3)

comment:1 Changed 4 years ago by jezdez

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to worksforme
  • Status changed from new to closed

I don't understand what setting STATIC_ROOT dynamically would bring.

To reiterate, STATIC_ROOT is not the file system location you put your static files into but where the staticfiles' app collectstatic management command copies files to. In other words, if you have separate directories you want the staticfiles app to consider to copy, just add those separate directories to the STATICFILES_DIRS setting. For example if you have a "project" static directory, e.g.:

STATIC_ROOT = "/var/www/static"
STATIC_URL = "/static/"
STATICFILES_DIRS = (
    "/path/to/my/site/project/static",
)

comment:2 follow-up: Changed 4 years ago by carlopires

This SHOULD be on documentation to avoid confusion:

"STATIC_ROOT is not the file system location you put your static files into but where the staticfiles' app collectstatic management command copies files to."

comment:3 in reply to: ↑ 2 Changed 4 years ago by jezdez

Replying to carlopires:

This SHOULD be on documentation to avoid confusion:

"STATIC_ROOT is not the file system location you put your static files into but where the staticfiles' app collectstatic management command copies files to."

This is covered here: http://docs.djangoproject.com/en/dev/ref/settings/#std:setting-STATIC_ROOT

Note: See TracTickets for help on using tickets.
Back to Top