Code

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#15035 closed (fixed)

collectstatic does not support remote backends that implement modified_time

Reported by: bendavis78 Owned by: jezdez
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: UI/UX:

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 bendavis78 3 years ago.

Download all attachments as: .zip

Change History (5)

Changed 3 years ago by bendavis78

comment:1 Changed 3 years ago by jezdez

  • Component changed from Uncategorized to Contrib apps
  • milestone set to 1.3
  • Needs documentation unset
  • Needs tests unset
  • Owner changed from nobody to jezdez
  • Patch needs improvement unset
  • Status changed from new to assigned
  • Triage Stage changed from Unreviewed to Accepted
  • Version changed from SVN to 1.3-beta

Can you please check if this also works?

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

comment:2 Changed 3 years ago by bendavis78

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 Changed 3 years ago by jezdez

  • Resolution set to fixed
  • Status changed from assigned to closed

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

comment:4 Changed 3 years ago by jacob

  • milestone 1.3 deleted

Milestone 1.3 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.