Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

URL_METHOD_2 still requires setting MEDIA_ROOT #23

Open
remocrevo opened this issue May 21, 2020 · 1 comment
Open

URL_METHOD_2 still requires setting MEDIA_ROOT #23

remocrevo opened this issue May 21, 2020 · 1 comment

Comments

@remocrevo
Copy link
Contributor

With the following settings in my settings file, the url files/FILENAME.pdf successfully serves a file:

MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
DEFAULT_FILE_STORAGE = 'binary_database_files.storage.DatabaseStorage'
DB_FILES_AUTO_EXPORT_DB_TO_FS = False
DATABASE_FILES_URL_METHOD = 'URL_METHOD_2'

However, if I remove the MEDIA_ROOT setting, I get a FileNotFoundError with the following traceback:

/home/rjs7/git/hh_letters/hhenv/lib/python3.5/site-packages/binary_database_files/views.py in serve_mixed

  • Line 36: return django_serve(request, name, document_root)
  • Local vars shows: document_root = ''

I thought I could setup this package to avoid using the file system at all. But I see now that the files appear in my MEDIA_ROOT directory after I successfully download them, which I didn't expect. Maybe this just needs to be added to the documentation so people know they must set MEDIA_ROOT even if they don't want to serve files from the file system.

Thanks for your work on this package.

Remington

@jsonn
Copy link
Contributor

jsonn commented Aug 3, 2020

There are two parts here. I think requiring MEDIA_ROOT to be set is reasonable, so I'm not touching that part. But always writing the file doesn't seem sensible and conflict with the name of the option. So #27 disables that part.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants