Django image processing and other media content

I am learning Django using the django book and it is great. However, this does not work a bit on the django test server to serve image files and other media. Obviously, any page has a certain amount of image content outside of the HTML code that you put in the templates. And there are other files that need to be served, such as CSS files and possibly not native files (such as PDFs, spreadsheets, RDF, xml, etc.).

Of course, I can install all this in Apache, however I need to be able to service most of them (especially gifs, png, etc.) during the development process. It doesn't seem to me like an obvious way to tweak this.

Can someone tell me how django developers do this? What is the standard practice? Should I use Apache as a development server?

thank.

+3
source share
3 answers

The documentation is very helpful.

+1
source

There is nothing wrong with using a development server for development. It is extremely convenient and specially designed for this purpose.

That the developers of Django and Django Book are trying very hard to push people away from using the development server for production. This is a very VERY BAD IDEA.

+1
source

django .

- urls.py

if DEBUG:

(r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
    {'document_root': '/path/to/media'}),

PS: - nginx .

0

Source: https://habr.com/ru/post/1758983/


All Articles