FineUploader / server-examples

Server-side examples for the Fine Uploader library
https://fineuploader.com
MIT License
279 stars 204 forks source link

Flesh out the python/Flask/S3 example #57

Closed mozz100 closed 6 years ago

mozz100 commented 7 years ago

I found FineUploader very good to work with; but the python Flask example for s3 took me a while to get to grips with.

This pull request fleshes it out to a fully-working example, supporting python 2 or 3. The only thing needed to use it are the Amazon settings/credentials, supplied as environment variables.

CLAassistant commented 7 years ago

CLA assistant check
All committers have signed the CLA.

rnicholus commented 7 years ago

Thanks for this! Just a couple things I'd like to see even before I take a closer look at the code, if you could:

  1. Going forward, it would be great for all server-side examples to exist in their own GitHub repository underneath the FineUploader organization. This would be a good opportunity to create a python-flask repo.
  2. I'd like to see all non-server-side code removed. Checking Fine Uploader client-side code means that this code will be stale at some point since it is unlikely I will remember to update the client-side code in this example every time the fine-uploader repo is updated. Instead, users can be directed to download Fine Uploader using any of the available methods, documented in the getting started guide.
mozz100 commented 7 years ago
  1. I agree - at least separating them out by language would make sense.

  2. Feel free to remove static files. However, as a newcomer to using FineUploader it took me several hours to work through the integration between client side and server side, making mistakes, debugging, chasing through options and configuration. In addition to the FineUploader files themselves, this pull request includes javascript that configures FineUploader client-side, and "joins the dots" to the server code. Admittedly, I made my own choices when doing so.

    I would have loved a fully-fleshed "fire it up and run it" example like this - to see how it's all put together. Either the server-side code goes stale because of a backwards-incompatible change in FineUploader client code, in which case it's good to have an example that keeps working, or it doesn't, and the example will continue to work when the client side code is updated to the latest version. One solution could be to publish FineUploader as a bower package or similar? Then a precise version could be specified without checking in static files. npm install seems an unusual way to do this (location of node_modules folder could be anywhere, whereas .bowerrc is intended for speccing static file requirements)

rnicholus commented 7 years ago

as a newcomer to using FineUploader it took me several hours to work through the integration between client side and server side

Was the server-side guide not helpful? If not, I'd like to figure out where it is lacking so other developers who need to create their own server-side code not based on existing examples can do so easily.

Either the server-side code goes stale because of a backwards-incompatible change in FineUploader client code

That never happens. In fact, I don't recall ever pushing out a change like this, since changing server-side code is often much more difficult than making a few client-side adjustments.

One solution could be to publish FineUploader as a bower package or similar?

It is published to npm and bower. Bower is becoming a less common repository for JS files. You'll find most, if not all, new JS projects publish to npm exclusively. And node_modules is always located on the same level as your package.json file, which all of your web projects should have. The "Getting Started" guide mentions this.

Your best course of action when integrating Fine Uploader (though this could apply to any JS library) is:

  1. Add an appropriate entry to package.json
  2. npm install
  3. Server-side, create a path alias, such as /static that points at the node_modules directory
  4. Client-side, reference /static/fine-uploader/... when pulling JS/CSS files.
  5. Do not check 3rd-party project code/dependencies into source control. That's why code repositories exist.
rnicholus commented 6 years ago

no activity in a while, so closing