We usually make file or image related changes from the frontend. In this article, we will see how to make file management at Admin panel where we can manage different types of file that we are going to render from server to client.
Install the django-filer module −
pip install django-filer
In settings.py, add the following −
INSTALLED_APPS = [ ... 'easy_thumbnails', 'filer', 'mptt', ... ] THUMBNAIL_HIGH_RESOLUTION = True THUMBNAIL_PROCESSORS = ( 'easy_thumbnails.processors.colorspace', 'easy_thumbnails.processors.autocrop', #'easy_thumbnails.processors.scale_and_crop', 'filer.thumbnail_processors.scale_and_crop_with_subject_location', 'easy_thumbnails.processors.filters', )
Here, we have just added the necessary libraries as apps in our project. We added some image pre-processing.
Now, you are all done for the Admin page. Let us make conical urls for the uploaded files.
In urls.py, add the following −
urlpatterns = [ ... path(r'filer/', include('filer.urls')), ... ]
Here, we created an URL for the file manager, where all our files or images will be stored.
Now for conical url, go to the folder and you will see a button, click on it and you will get conical url −