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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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