Skip to main content

A file upload application for DjangoRestFramework

Project description

A file upload application for DjangoRestFramework

Installation

python3 -m pip install drf-fileupload-api

Usage

  • edit project/settings.py
INSTALL_APPS += [
    'drf_fileupload',
]

MEDIA_ROOT = 'data/'  # default: /

FILE_UPLOAD_TO = 'upload/%Y/%m/%d'   # support strftime format, default: MEDIA_ROOT
FILE_UPLOAD_MAX_SIZE = '10M'              # limit max file size, default: None
  • edit project/urls.py
from django.conf import settings
from django.conf.urls.static import static

urlpatterns = [
    path('api/admin/', admin.site.urls),
    path('api/fileupload/', include('drf_fileupload.urls')),
]

urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

API

Demo

git clone https://github.com/suqingdong/drf_fileupload

cd demo

python3 -m pip install -r requirements.txt

python3 manage.py makemigrations

python3 manage.py migrate

python3 manage.py createsuperuser

python3 manage.py runserver

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

drf_fileupload_api-1.0.1.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

drf_fileupload_api-1.0.1-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

Details for the file drf_fileupload_api-1.0.1.tar.gz.

File metadata

  • Download URL: drf_fileupload_api-1.0.1.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.3

File hashes

Hashes for drf_fileupload_api-1.0.1.tar.gz
Algorithm Hash digest
SHA256 d065bafaeee7c3755878f6fd95ff5020ffd3b608fa0313e2288d6c0f1c8d2109
MD5 0352ba226261c0603155a5814885f141
BLAKE2b-256 2897ffa7f3c31393a0e9c68e8ad3997e644910961e0685463a16bd6a69a6affd

See more details on using hashes here.

File details

Details for the file drf_fileupload_api-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: drf_fileupload_api-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.0.1 pkginfo/1.7.0 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.8.3

File hashes

Hashes for drf_fileupload_api-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8be461487108fd3850f9572c025a9fa9f1eb2572c5408d9d144869a3e3dea8f3
MD5 3f21f3e81e39e7e653a3c0f563a9937d
BLAKE2b-256 2326a99444ff5e5a3ab4c9db82a335471340f23b47ef3918475bc065d3f17a0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page