Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
If you just need access to files from django that are in the media folder, then https://docs.djangoproject.com/en/dev/howto/static...
Same thing, but in Russian
djbook.ru/rel1.7/ howto/static-files/index.html#ser...
If on production, then some kind of nginx
But I don’t quite understand why files are needed in the media folder, but their path is not stored anywhere O_o
for local development in urls.py
from django.conf.urls.static import static
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
What does it mean to upload images?
You can print a list of them and do whatever you want with it:
import os
from django.template import RequestContext
from django.conf import settings
from django.shortcuts import render_to_response
def view(request):
media_files = [ f for f in listdir(settings.MEDIA_ROOT) if isfile(join(settings.MEDIA_ROOT,f)) ]
...
return render_to_responce('media_index.html',{'files':media_files},context_instance=RequestContext(request))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question