Questions tagged [django-media]

237 questions
1
vote
0 answers

How to upload PDF files in django

model class CustomerInfo(models.Model): customer_name = models.CharField(max_length=50) customer_letter= models.FileField(upload_to='/media/',null= True, blank=model class CustomerInfo(models.Model): customer_name =…
EHAB
  • 11
  • 2
1
vote
1 answer

Serve uploaded files from NGINX server instead of gunicorn/Django

I have separate servers one running NGINX and other running gunicorn/Django, I managed to serve static files from NGINX directly as recommended from Django documentation, but I have an issue with files uploaded by users, which will be upload to…
Emad Mokhtar
  • 3,237
  • 5
  • 31
  • 49
1
vote
0 answers

Uploading images in Django, hopefully a step-by-step guide?

OK, so I must totally be missing something here... For clarification this is with Django 1.9.7 My model has a field: prop_image = models.ImageField(upload_to=settings.MEDIA_ROOT, null = True, blank = True, max_length=500) I have imported settings,…
1
vote
1 answer

How to extract images from a document using pypandoc into a different folder in media repository of a project in Django?

I am currently trying to extract the images from a document that the user is uploading into the media repository of my Django app. The code that currently works for me is: html = pypandoc.convert( tmp_loc, 'html5', …
Arunabh Ghosh
  • 318
  • 3
  • 11
1
vote
2 answers

Django 1.9: Unable to see uploaded photos

I have some photos uploaded but I was unable to see photos in temeplates My template {% extends 'base.html' %} {% load staticfiles %} {% block content %}

{{ object.title }}

{%…
spidy
  • 269
  • 2
  • 13
1
vote
1 answer

Django - Serving user uploaded media files

I'm trying to display the media file(image) on the template of a DetailView. I ran print statements to check where the MEDIA_ROOT and MEDIAFILES_DIRS are pointing, and they both point correctly to /project/static/media. So I try to call it on the…
Chris
  • 449
  • 1
  • 9
  • 18
1
vote
0 answers

Django nginx returning 502 Bad Gateway status code

Edit: I re-followed the instructions and now this is the issue I am having: Django Nginx not serving media files I'm following this tutorial: http://uwsgi-docs.readthedocs.org/en/latest/tutorials/Django_and_nginx.html Everything was going well until…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
1
vote
2 answers

Unable to view media files in django

I have correctly set the settings for media in settings.py as:- MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') and also specified the correct url settings if settings.DEBUG: urlpatterns += patterns( 'django.views.static', …
Anshdeep singh
  • 63
  • 1
  • 1
  • 6
1
vote
2 answers

django media_root not working

I'm using django 1.6 in my settings I have this, which works fine, STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static/'), ) but the moment I add: `MEDIA_ROOT = os.path.join(BASE_DIR, 'media/'), I get a error while rendering a…
Reed Jones
  • 1,367
  • 15
  • 26
1
vote
2 answers

How to Serve Django media user uploaded files using Cherokee with restriction to logged users

How to configure Django and Cherokee to serve media (user uploaded) files from Cherokee but to logged in users only as with @login_required on production.
Cherif KAOUA
  • 834
  • 12
  • 21
1
vote
1 answer

AWS / Django - do I save private user uploaded files to S3 or on my EC2 instance?

I have a Django web application which allows users to upload their display picture. Some users can see this display picture but not everyone (not all users) should have access to this picture. With that said, in development, I used to save it…
SilentDev
  • 20,997
  • 28
  • 111
  • 214
1
vote
1 answer

Django admin serving uploaded image

I am new to Django I'm stuck with regards to how I can fix this issue. I have a a model which contains an ImageField as follows name = models.CharField(max_length=100) description = models.CharField(max_length=1000) file =…
1
vote
2 answers

How to refer to MEDIA_URL from settings.py in models.py?

I know that it is maybe not the most beautiful thing to partialy deling with view in model, but for now I would like to solve my problem this way. in my models.py for one class I define: def admin_image(self): return '' %…
andilabs
  • 22,159
  • 14
  • 114
  • 151
1
vote
1 answer

Rendering user uploaded html5/js games inside a django template

I am sure there is a very simple way to solve my problem but I am not experienced enough to think of anything useful. I have a website on which I want to be able to add html5/js games I make on. It will be a very simple site; a template that acts as…
maxcmoi
  • 11
  • 2
1
vote
2 answers

Why is django not serving my media files?

In my settings.py, ROOT_PATH = os.path.dirname(__file__) #STATICFILES_DIRS = STATIC_ROOT = os.path.join(ROOT_PATH, 'static') MEDIA_ROOT = os.path.join(ROOT_PATH, 'media') STATIC_URL = '/static/' MEDIA_URL = '/media/ in my template,
Suziemac Tani
  • 455
  • 9
  • 23