whitebear
whitebear

Reputation: 12433

Django folder structure for created file, static? media? or another one?

I want to create the file(.wav) by django and let it be downloaded by user.

Currently I create the file under /myproj/static directory.

However it is mixed with the other jpg/img files, so,, it's not good design?

then, I read the document about /myproj/media directory but it is said used for user upload files.

So,,, how is the good directory design for server created file?

Should I create such as /myproj/create_wav?

but how can user access this url in template?

Thank you for any idea or helps.

Upvotes: 0

Views: 707

Answers (1)

Gonçalo Peres
Gonçalo Peres

Reputation: 13582

According to Django's documentation,

By default, Django stores files locally, using the MEDIA_ROOT and MEDIA_URL settings. (...) However, Django provides ways to write custom file storage systems that allow you to completely customize where and how Django stores files.

So, in OP's shoes I'd simply use the media folder, since that's used not only for user uploads but also for user downloads.

Upvotes: 1

Related Questions