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

adding media type support #162

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

asif-mahmud
Copy link
Contributor

as Eve documentation says it supports uploading media/files by media type. this commit is just following the example at http://python-eve.org/features.html#file-storage. One test is added for checking the validity of it.

@dkellner
Copy link
Collaborator

Thanks for your PR! As I never used the media feature with neither Eve nor Eve-SQLAlchemy: If I understand the docs and your posts in #161 correctly, this is not enough to actually make Eve-SQLAlchemy accept and store files, right?

Ideally we would have a working example or even integration test for this feature.

In any case we should update the docs too, as Eve docs just mention the use of GridFS, which I suppose is not the storage system of choice for Eve-SQLAlchemy users.

@asif-mahmud
Copy link
Contributor Author

Ya, thats true, we could provide a file system based storage. I have a working example of that. it takes in a
few storage configurations like where to save files, if it serve them as url or base64 encoded string like the one option in GridFS example.

@ernests
Copy link

ernests commented Feb 11, 2021

Hi!
Is there plan to merge this into master?
I have implemented media in MongoDB with AWS S3 backend. So in reality there are only links saved into db. Having "type": "media" is handy as Eve automatically saves media link and takes care of "media" endpoint.

@ernests
Copy link

ernests commented Feb 11, 2021

fyi - forked, merged/implemented changes from this pr. With s3-storage plugin (https://github.com/gwainer/eve-s3storage/) implemented file storage on S3. It works.

p.s. there is a bug in eve-s3storage related to base64 encoding if RETURN_MEDIA_AS_BASE64_STRING is not set to False

@dkellner
Copy link
Collaborator

I'm open to merging this - but don't really have time at the moment to update the docs myself. IMO we should at least add an example on how to use this, as Eve's docs will not apply here (it mentions that GridFS is used by default).

If you could step in, rebase this on current master and add a short section on how to get this up and running, I think we're good to go! :-)

@ernests
Copy link

ernests commented Feb 19, 2021

I might try this. Haven't committed anything to public open-source project. Might need an assistance.

@dkellner
Copy link
Collaborator

No problem there - there's always a first! You can start by copying eve_sqlalchemy/examples/simple/ to something like eve_sqlalchemy/examples/media/ and getting a simple example to work. Preferrably not with S3 or any cloud service, but with the local filesystem to avoid depending on third parties.

Once you've got something, just create a PR (even if it's not ready yet), so I can give feedback.

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

Successfully merging this pull request may close these issues.

3 participants