Bulletproof attachment serving for Django Rest Framework.
Project description
Yediemin
A package for bulletproof attachment serving in Django Rest Framework.
Getting Started
Requirements
- Nginx
- Django Rest Framework
- Session Authentication
- Django Storages (S3)
Installation Steps
- Install package from PyPi.
pip install yediemin
- Add the view to
urls.py
from yediemin import YedieminView
urlpatterns = [
re_path(r'^yediemin/(?P<file_name>\S+)/$', YedieminView.as_view(), name='yediemin'),
]
- Configure Nginx. Place the configuration below under your server.
location /yediemin-files/ {
internal;
resolver 8.8.8.8;
set $redirect_uri "$upstream_http_redirect_uri";
proxy_buffering off;
proxy_pass $redirect_uri;
}
- Use
YedieminFileField
in serializer forFileField
.
from yediemin import YedieminFileField
class AttachmentSerializer(serializers.ModelSerializer):
file = YedieminFileField()
class Meta:
model = Attachment
fields = (
"id",
"file",
)
- Upload files to S3 as private. Yediemin requires presigned object url.
# settings.py
AWS_QUERYSTRING_AUTH = True
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
yediemin-0.1.1.tar.gz
(3.8 kB
view hashes)
Built Distribution
Close
Hashes for yediemin-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 338e32e4ba5b09efd717b2c333e9b1217ca5d925ac65b9e7faecbec095f61ada |
|
MD5 | 98f09dd250887495c53304ba7319621d |
|
BLAKE2b-256 | 1b8da14626ed765667b667540586ead775647ed6e91656d3ed40d3a36561cc42 |