Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

managin media django

#in base url
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
#in setting
MEDIA_ROOT = BASE_DIR / 'media'
MEDIA_URL = '/media/'
Comment

media django

from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    # ... the rest of your URLconf goes here ...
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

# ----------------or----------------

# urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

Comment

PREVIOUS NEXT
Code Example
Python :: tqdm for jupyter notebook 
Python :: numpy merge arrays 
Python :: python regex numbers only 
Python :: user agents list 
Python :: how to read docx file in python 
Python :: how to replace a word in csv file using python 
Python :: python duplicate file 
Python :: how to generate a random number python 
Python :: STandardScaler use example 
Python :: how to take screenshots with selenium webdriver python 
Python :: open website python 
Python :: split a path into all subpaths 
Python :: bgr2gray opencv 
Python :: cannot remove column in pandas 
Python :: how to create correlation heatmap in python 
Python :: how to save a dictionary to excel in python 
Python :: initialize pandas dataframe with column names 
Python :: how to locate image using pyautogui 
Python :: read txt file pandas 
Python :: between date pandas 
Python :: random word generator python 
Python :: label encoding in pandas 
Python :: tkinter maximum window size 
Python :: how to find runner up score in python 
Python :: python read gzipped file 
Python :: get working directory python 
Python :: confusion matrix seaborn 
Python :: get current month py 
Python :: matplotlib plot adjust margins 
Python :: draw circles matplotlib 
ADD CONTENT
Topic
Content
Source link
Name
1+5 =