Re: Flat file application for binary data?
On Feb 5, 2010, at 1:27 PM, Peter Herndon wrote: > FileFields and ImageFields are by default stored on disk, with just a pointer > stored in the db. For more examples, take a look at David Larlet's > django-storages (http://code.welldev.org/django-storages/wiki/Home) and > Justin Driscoll's ImageKit > (http://bitbucket.org/jdriscoll/django-imagekit/wiki/Home), both of which > should give you at least a starting point. With ImageKit, for example, you > create a "spec" for your image fields, and part of the spec is a means of > determining the filesystem storage location (including a method you can > define if you need to). > Looking at the django-storages code gave me some useful ideas. Thanks, Peter. John -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Flat file application for binary data?
On Feb 5, 2010, at 12:36 PM, Mike Ramirez wrote: > It's built in. > > http://docs.djangoproject.com/en/dev/topics/http/file-uploads/ > > http://docs.djangoproject.com/en/dev/ref/files/storage/ > > Between those two docs, you should be able to do everything you want. AFAIK, > no file uploads are stored directly in the database, though there is a model > behind it, it stores the path,. > I know about those, and they don't do what I'm looking for. At least, not as I understand them. I'm looking at the next architectural level up. For example, creating an md5 or sha1 hash directory under a file root, where file uploads can be organized in /mm/dd folders. And providing the linkage from the user account in the SQL db, to their binary file directory. I was hoping someone else had packaged this kind of support for binary-objects-stored-in-files in a nice and purty application. :-) I'll chew on this more. Maybe a custom storage system backend is the way to go. (http://tinyurl.com/yjh7st4) John -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Flat file application for binary data?
Also check the FileField for info on how django handles files by default. Probably the best starting point. http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield and sending files is a view like this: def project_download(request, project, filename, version): project_file = get_object_or_404(ProjectFile, project__slug__exact=project, name__exact=filename, version__icontains=version) file_name = os.path.basename(project_file.file.name) mimetype, encoding = mimetypes.guess_type(project_file.file.path) response = HttpResponse(mimetype=mimetype) response.write(project_file.file.path) response['Content-Disposition'] = 'attachment; filename=%s' %(file_name) The Content-Dispostion header is what lets the browser know there is a file coming (sorry for hitting send a bit early). Mike. -- Work smarter, not harder, and be careful of your speling. signature.asc Description: This is a digitally signed message part.
Re: Flat file application for binary data?
On Friday 05 February 2010 10:44:42 John DeRosa wrote: > I'm building a site that will include using lots of image files, audio > clips, and video clips. Including users uploading these things and then > later referencing them. > > I don't want to store this binary data in the database, but instead want to > store them in disk files. > > I've looked for a Django app that manages flat files, and can't find one. > By "manage," I mean functions like organizing the directory into a > year/mo/date (for example) structure, returning filenames for new data to > be recorded into a database table, and returning the binary data given a > link. This stuff isn't rocket science, but I'd rather not code it from > scratch. > > Anybody know of an suitable application for this? > It's built in. http://docs.djangoproject.com/en/dev/topics/http/file-uploads/ http://docs.djangoproject.com/en/dev/ref/files/storage/ Between those two docs, you should be able to do everything you want. AFAIK, no file uploads are stored directly in the database, though there is a model behind it, it stores the path,. Mike -- "Nominal fee". What an ugly sentence. It's one of those things that implies that if you have to ask, you can't afford it. -- Linus Torvalds signature.asc Description: This is a digitally signed message part.
Re: Flat file application for binary data?
>> Anybody know of an suitable application for this? >> > > FileFields and ImageFields are by default stored on disk, with just a pointer > stored in the db. For more examples, take a look at David Larlet's > django-storages (http://code.welldev.org/django-storages/wiki/Home) and > Justin Driscoll's ImageKit > (http://bitbucket.org/jdriscoll/django-imagekit/wiki/Home), both of which > should give you at least a starting point. With ImageKit, for example, you > create a "spec" for your image fields, and part of the spec is a means of > determining the filesystem storage location (including a method you can > define if you need to). > > ---Peter Herndon Note that you can do storage like /yy/mm/dd natively in Django without addons. -Wayne -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Flat file application for binary data?
On Feb 5, 2010, at 1:44 PM, John DeRosa wrote: > I'm building a site that will include using lots of image files, audio clips, > and video clips. Including users uploading these things and then later > referencing them. > > I don't want to store this binary data in the database, but instead want to > store them in disk files. > > I've looked for a Django app that manages flat files, and can't find one. By > "manage," I mean functions like organizing the directory into a year/mo/date > (for example) structure, returning filenames for new data to be recorded into > a database table, and returning the binary data given a link. This stuff > isn't rocket science, but I'd rather not code it from scratch. > > Anybody know of an suitable application for this? > FileFields and ImageFields are by default stored on disk, with just a pointer stored in the db. For more examples, take a look at David Larlet's django-storages (http://code.welldev.org/django-storages/wiki/Home) and Justin Driscoll's ImageKit (http://bitbucket.org/jdriscoll/django-imagekit/wiki/Home), both of which should give you at least a starting point. With ImageKit, for example, you create a "spec" for your image fields, and part of the spec is a means of determining the filesystem storage location (including a method you can define if you need to). ---Peter Herndon -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Flat file application for binary data?
I'm building a site that will include using lots of image files, audio clips, and video clips. Including users uploading these things and then later referencing them. I don't want to store this binary data in the database, but instead want to store them in disk files. I've looked for a Django app that manages flat files, and can't find one. By "manage," I mean functions like organizing the directory into a year/mo/date (for example) structure, returning filenames for new data to be recorded into a database table, and returning the binary data given a link. This stuff isn't rocket science, but I'd rather not code it from scratch. Anybody know of an suitable application for this? Thank you in advance, John -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.