You can take a look at django-db-file-storage
https://readthedocs.org/projects/django-db-file-storage/
In my case, I was making something for myself and the hosting server
doesn't allow me access to any kind of file system, so I found this.
On Fri, 2016-05-06 at 15:42 -0500, Alex Heyden wrote:
> There's an ImageField for use in models, but to really understand it,
> start with FileField
> 
> https://docs.djangoproject.com/en/1.9/topics/files/
> https://docs.djangoproject.com/en/1.9/ref/models/fields/#django.db.mo
> dels.FileField
> 
> The general idea is that you have a directory configured by Django's
> settings that you can use to hold uploaded files. You can also use
> Django to serve these files if you want. (I tend to use nginx
> directly for this for performance reasons, but you do what works for
> you.)
> 
> I wouldn't go so far as to say that there's no use case for storing
> images in databases, but in general, André's advice is solid: store
> the path instead. Your OS is good at managing files. Let it do its
> job.
> 
> On Fri, May 6, 2016 at 2:53 PM, André Machado 
> com> wrote:
> > NEVER store images in DB, store its path so you can use it in a img
> > tag later. =)
> > 
> > > 
> > > Hi guys, I'm a TOTAL noob when it comes to django and web
> > > development for that matter. I have an idea for a web app and I
> > > do have a basic understanding of programming. I've gone through a
> > > few Django tutorials and I'm confident I can do it, I just need
> > > help along the way :) 
> > > 
> > > So, my "brilliant" idea is to make an app for cooking for
> > > dummies. Basically, I'd have a repository of recipes. Each recipe
> > > consists of: recipe_ID, name, and 10 instruction-photo pairs
> > > ("now do this" + photo of that).
> > > 
> > > The photos are relatively lightweight (less than 50k each) so I
> > > think storing them in a database is the way to go. The only snag
> > > - I have absolutely no idea how to do it. I've googled a lot but
> > > I'm either too thick or my needs are too specific. 
> > > 
> > > I don't actually need to be able to store the images in the
> > > database through the web app. I was thinking of creating folders
> > > that contain the pertinent photos and "somehow" storing them in
> > > the database for further use. The name of the folder would be the
> > > same as the recipe_ID, and the photos would be named
> > > recipe_ID_01.jpg, recipe_ID_02.jpg, ...
> > > 
> > > Thanks in advance for any help you can give me :) 
> > > 
> > > 
-- 
Adam ([email protected])


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/1462577175.4828.32.camel%40csh.rit.edu.
For more options, visit https://groups.google.com/d/optout.

Reply via email to