Hello everyone, I just discovered this group through Google.I couldn't get any help on stack overflow and hopefully someone here can help.
I have deployed a Django App on a Ubuntu server for the first time using Nginx and gunicorn.
Before deployment, I used port 8000 to test if everything runs as it is supposed to and all was fine. Since I allowed 'Nginx Full' my database images are not showing up.
This is my django project structure:
My virtual environment folder and my main project folder are both in the same directory. I have separated them.
I have set up my settings.py to :
My view gets all the project object from a database and passes those to the template. The template renders successfully all other information related to project model except the image field . In my template I do:
Uploading the images works, it sends them in the project's media directory, the problem is that they are not showing up, the alt="" is activated.
My main urls.py:
The gunicorn system file:
Nginx setup:
Hi, first of all welcome on this group. Secondly you can also try https://webchat.freenode.net/ on the #django channel but you first need to register there by asking on #freenode channel. Regarding your problem, images are static files and you should put them in static/<appname>/your_desired_path to be detectable not media if they are part of your templates. Use src={% url “your_desired_path %} and don’t forget to put {% load static %} at the top of your template.
Sent from Mail for Windows 10
--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/635fcf7e-6e53-425d-aad1-8638fef425c1o%40googlegroups.com.
Sorry, I misunderstood your problem. But can you also show your views.py. Also your path to MEDIA_ROOT is obfuscated. I used MEDIA_ROOT = os.path.join(BASE_DIR, 'media'). I thing this shall be sufficient to do for a try.
--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/d4758123-f506-401b-b488-c3f17385d9fco%40googlegroups.com.
If the issue is managing static files on the server simply installing Django-heroku saved me from all that trouble.
From: Rob Riedlinger
Sent: 21 June 2020 23:40
To: Django users
--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/33d4c599-135d-45d9-abbc-978e404e4f87o%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/A68703DE-32D6-417B-AF0F-64EACA533FE0%40hxcore.ol.
--
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 django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/343c056c-cd83-4ce2-a898-ecf21ef0165fo%40googlegroups.com.