Opened 14 years ago

Closed 14 years ago

Last modified 8 years ago

#15035 closed (fixed)

collectstatic does not support remote backends that implement modified_time

Reported by: Ben Davis Owned by: Jannis Leidel
Component: Contrib apps Version: 1.3-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

My CDN (rackspace cloud files) supports getting the modified time of an object. If I implement modified_time() in my cloud storage app, we get an exception:

Traceback (most recent call last):
  File "./manage.py", line 26, in <module>
    management.execute_from_command_line()
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/core/management/__init__.py", line 429, in execute_from_command_line
    utility.execute()
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/core/management/base.py", line 191, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/core/management/base.py", line 220, in execute
    output = self.handle(*args, **options)
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/contrib/staticfiles/management/commands/collectstatic.py", line 78, in handle_noargs
    self.copy_file(source, prefix, storage, **options)
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/contrib/staticfiles/management/commands/collectstatic.py", line 130, in copy_file
    self.destination_storage.path(destination))
  File "/home/ben/Projects/SavidWorks/ellableu/.env/src/django/django/core/files/storage.py", line 86, in path
    raise NotImplementedError("This backend doesn't support absolute paths.")
NotImplementedError: This backend doesn't support absolute paths.

This can be fixed by setting destination_is_link to False when self.distination_local is False. Patch is attached.

Attachments (1)

collectstatic_remote_modified_time_fix.diff (780 bytes ) - added by Ben Davis 14 years ago.

Download all attachments as: .zip

Change History (6)

comment:1 by Jannis Leidel, 14 years ago

Component: UncategorizedContrib apps
milestone: 1.3
Owner: changed from nobody to Jannis Leidel
Status: newassigned
Triage Stage: UnreviewedAccepted
Version: SVN1.3-beta

Can you please check if this also works?

https://github.com/jezdez/django/compare/master...trac-15035

comment:2 by Ben Davis, 14 years ago

Yup, works for me. Thanks!

Also thanks for leading me to discover that Django has an official git clone -- that makes me all types of happy :-D

comment:3 by Jannis Leidel, 14 years ago

Resolution: fixed
Status: assignedclosed

(In [15154]) Fixed #15035 -- Fixed collectstatic management command to work with non-local storage backends correctly. Also refactored a bit code smell.

comment:4 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

comment:5 by Tim Graham <timograham@…>, 8 years ago

In bff4abac:

Refs #15035 -- Corrected a bug and improved comments for a staticfiles test.

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