Русские видео

Сейчас в тренде

Иностранные видео




Если кнопки скачивания не загрузились НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием, пожалуйста напишите в поддержку по адресу внизу страницы.
Спасибо за использование сервиса ClipSaver.ru



Understanding Django Media Files

Setting up Django media files for development is about understanding what MEDIA_URL is and MEDIA_ROOT. MEDIA_URL is simply a URL prefix (or "slug") that tells Django what the URL should look like when accessing media files from the MEDIA_ROOT. For example, if you wanted your MEDIA_URL to be: "/uploads/", whenever Django attempted to access files in your MEDIA_ROOT, it would prefix the URL with "/uploads/some-file.whatever". Since we know that, understanding the MEDIA_ROOT is simple. It's just the directory that holds the files that users upload. One directory. Holds user uploads. That's it. When setting up Django media files locally, we have to define MEDIA_URL and MEDIA_ROOT in the settings.py. We also need to add the following to the project's main urls.py file: 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) This mysterious static () thing just generates a URL pattern in regex and appends it to the urlpatterns list. Helpful links: https://docs.djangoproject.com/en/2.2... https://docs.djangoproject.com/en/2.2... https://docs.djangoproject.com/en/2.2... https://timmyomahony.com/blog/static-... #Django #Python

Comments