R
Railwayβ€’17mo ago
MIGHTY_MIDHUN

Django issue with images

I have a django app with debug set as False. I upload images from the UI and I cant see the uploaded images because the debug is set to false. So how do I resolve this issue. For example : if I upload image in django superadmin then also I cant view them
24 Replies
Percy
Percyβ€’17mo ago
Project ID: fd0bd18d-392d-4b0d-af5c-395356468583
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
fd0bd18d-392d-4b0d-af5c-395356468583
Brody
Brodyβ€’17mo ago
please reference this template https://railway.app/template/AWUIv6
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
Hi Brody. Can u provide further help on how to use this. There is no proper documenation regarding this
Brody
Brodyβ€’17mo ago
does the template not work?
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
I dont know how to connect this to my django app
Brody
Brodyβ€’17mo ago
please review the code of that template and make the needed changes in your code
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
Im very new to this and i dont know where the code for this template is
Brody
Brodyβ€’17mo ago
in the attached github repo, here is a direct link https://github.com/vfehring/django-volumes
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
thank you for providing this. But i cant figure out. how to connect this to my existing django deployed. should i change some environment variable ?
Brody
Brodyβ€’17mo ago
have you looked through all the code of the template?
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
I have
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
i added something like this to my django app
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
i dont know what i should provide for mount path
Brody
Brodyβ€’17mo ago
that is correct @Vin - could you provide some additional assistance when you are free
MantisInABox
MantisInABoxβ€’17mo ago
So, In your repo you want to focus on making your settings.py, urls.py files match the template repo settings and url files. You will also need to use the whitenoise package for serving your images. The template is there as a guide on how to structure your existing project to work with file uploads, or as a starting point for you to build your app on top of The mount point for your volume is perfect. Leave it that way I need to update the readme and the template docs today
Brody
Brodyβ€’17mo ago
thanks vin! πŸ™‚
MantisInABox
MantisInABoxβ€’17mo ago
No problem I know you have trouble with the words sometimes 🀣
Brody
Brodyβ€’17mo ago
its true
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
Thanks Vin for the help. actually I had to change my urls a little bit. #old urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) #new urlpatterns += [ re_path(r'^media/(?P<path>.*)$', serve, {'document_root': settings.MEDIA_ROOT})] Also Vin. One more help would be highly appreciate. how do i run the collect static command.
Brody
Brodyβ€’17mo ago
use a railway.json file like the template does, this eliminates the need for a Procfile (once you have a railway.json you delete the Procfile) https://github.com/vfehring/django-volumes/blob/master/railway.json#L7
MantisInABox
MantisInABoxβ€’17mo ago
If you look in the github associated with the template, you will see the command ^^
MIGHTY_MIDHUN
MIGHTY_MIDHUNOPβ€’17mo ago
Thank you very much for the help Brody. So as per my understanding the whatever we have provided within the startCommand in railway.json will be automatically executed whenever we update the repo. Am i right ?
MantisInABox
MantisInABoxβ€’17mo ago
This is correct. The railway.json command is everything that you need to to to start running your app
Want results from more Discord servers?
Add your server