0

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.

2
  • i would stick to /media static is for site .js, .css, some static images that site uses. Media is everything dynamic. Commented Aug 20, 2022 at 10:13
  • Hi. Folder structure is totally configurable. You should set what suits best for your application. Keeping things tidy and separated is of course advised. For example download/audio and download/img, it's really up to you. I'd keep static as the standard for CSS and other website static resources. Commented Aug 20, 2022 at 10:24

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.