Couldn't get the code to work

Issue #1 new
Justin Lindsey created an issue

Here is my relevant parts:

#Settings.py:
S3UPLOADER = { 
    # Generic model classes must be app_name.class_name
    'bucket_name': "us-east-1",
    'generic_model_class': 'attachments.File',
    'access_key_id': AWS_ACCESS_KEY_ID,
    'secret_access_key': AWS_SECRET_ACCESS_KEY,
    'template_name': 'bootstrap',
}

#Models.py
class File(Attachment, GenericUploadableMixin):
    class S3UploadableMeta:
        file_field = 'value'

    value = models.FileField(upload_to=file_destination, max_length=2048,
                             verbose_name=_('file'))

    def _get_filename(self):
        return os.path.basename(self.value.name)

    filename = property(_get_filename)
# s3uploader.html

{% load s3uploader %}
<html>
      <head>
      {% s3uploader_css %}
      {% s3uploader_js %}
  </head>
<body>
     {% s3uploader %}
  </body>
</html>

The "Choose File" normal form appears, but it doesn't upload to s3, and the additional fineuploader parts don't display. In fact they seem to have display:none on the css in the template.

Some additional things worth documenting:

You might need to rebuild the downloadable zip. Your project wasn't discoverable on pip, and when I tried to install directly from your bitbucket zip the download did not have your templates/templatetags.

Worth documenting that your template tags need to be loaded into the template, your urls need to be added to the project's urls.py, and the app needs to be added to INSTALLED_APPS in settings.py.

Comments (1)

  1. Michael Bethencourt repo owner

    Hey Justin, thanks for the feedback :)

    Sorry about the delay: I was on a long trip to a few different countries last few weeks, just now catching up with everything.

    So, I now looked through the README. Yes its a total mess, there are a few huge things are lacking in the documentation:

    • s3uploader requires jQuery to be loaded first before {% s3uploader_js %}. Also, this probably wont make a difference, but I usually put all my script tags files at the end of the page (tends to be better practice).

    • You must set up direct S3 uploading on your AWS account first. Here's a guide from Fine Uploader on how to do it. Like everything else on AWS its kind of a mess to configure, but once you get it done, it's done (at least).

    Let me know if you've already done both these things (or if the problem is resolved / given up) by now.

  2. Log in to comment