Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django serve media folder

# FOR DEBUG ONLY!!!
from django.urls import re_path
from django.views.static import serve

urlpatterns = [
    ...
    re_path(r'^media/(?P<path>.*)$', serve,{'document_root': settings.MEDIA_ROOT}), 
]
Comment

django give access to media folder

chgrp -R www-data /path/to/media/
chmod -R g+w  /path/to/media/
Comment

PREVIOUS NEXT
Code Example
Python :: remove part of string python 
Python :: python inject into process 
Python :: pygame text wrapping 
Python :: pillow image from array 
Python :: pandas series plot horizontal bar 
Python :: check if list is empty python 
Python :: run python script from repl 
Python :: python cv2 write to video 
Python :: seaborn barplot remove error bars 
Python :: create numpy array with ones 
Python :: Tensor.expand_as 
Python :: matp[lotlib max y value 
Python :: how to show mean values on histogram in seaborn 
Python :: python pandas read_excel 
Python :: vscode in browser github 
Python :: how to do randon in python 
Python :: pandas groupby and show specific column 
Python :: python tkinter entry widget 
Python :: enumarate in python 
Python :: pytest local modules 
Python :: temp python web server 
Python :: create dictionary 
Python :: python remove consecutive duplicates 
Python :: how to correlation with axis in pandas 
Python :: access myultiple dict values with list pythojn 
Python :: take first 10 row while reading csv python 
Python :: closedxml hide column 
Python :: numpy where 
Python :: histogram seaborn python 
Python :: basic flask app 
ADD CONTENT
Topic
Content
Source link
Name
8+6 =