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
Project ID:
fd0bd18d-392d-4b0d-af5c-395356468583
fd0bd18d-392d-4b0d-af5c-395356468583
please reference this template
https://railway.app/template/AWUIv6
Hi Brody. Can u provide further help on how to use this. There is no proper documenation regarding this
does the template not work?
I dont know how to connect this to my django app
please review the code of that template and make the needed changes in your code
Im very new to this and i dont know where the code for this template is
in the attached github repo, here is a direct link
https://github.com/vfehring/django-volumes
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 ?
have you looked through all the code of the template?
I have
i added something like this to my django app
i dont know what i should provide for mount path
that is correct
@Vin - could you provide some additional assistance when you are free
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
thanks vin! π
No problem
I know you have trouble with the words sometimes π€£
its true
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.
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
If you look in the github associated with the template, you will see the command ^^
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 ?
This is correct. The railway.json command is everything that you need to to to start running your app