Opened 6 years ago

Closed 6 years ago

#8675 closed (duplicate)

File storage - Storage objects example does not work

Reported by: whiskybar Owned by: nobody
Component: Documentation 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:


The example at the beginning of

does not work.

>>> from import default_storage

>>> path ='/path/to/file', 'new content')

will give you an error:

<type 'exceptions.AttributeError'>: 'str' object has no attribute 'chunks' 

The way to fix is to pass ContentFile('new content') from django.core.files.base. In fact, other examples should be double checked if they expect a string or a ContentFile-like object.

See for more information.

Attachments (0)

Change History (1)

comment:1 Changed 6 years ago by julien

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

Dupe of #8641

Add Comment

Modify Ticket

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

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

Note: See TracTickets for help on using tickets.