当前位置:网站首页>Django uploads local binaries to the database filefield field
Django uploads local binaries to the database filefield field
2022-06-13 05:19:00 【Puff o】
Django Upload the local binary file to the database FileField Field
First read the local binary file

Then import ContentFile package , Instantiate database , Then save the field ,FileField You need to use the built-in saving method. Binary files need to use ContentFile() Method to upload the data stream
Be careful : database .File Field name .save(“ Saved file name ”, ContentFile( Binary ))
Import ContentFile package
Instantiate database
Save the file

3. Saved successfully

边栏推荐
猜你喜欢

Listiterator list iterator

安装harbor(在线|离线)

Metaltc4.0 stable release

Metartc4.0 integrated ffmpeg compilation

Customer information management system - C language

List collection concurrent modification exception

Chapter 18 pagination: Introduction

Simple SR: best buddy Gans for highly detailed image super resolution

C language learning log 12.5

Case - simulated landlords (primary version)
随机推荐
Simple SR: best buddy Gans for highly detailed image super resolution
Clause 47: please use traits classes to represent type information
priority inversion problem
MySQL advanced query
Case - random numbers without repetition (HashSet and TreeSet)
Implementing the driver registration initcall mechanism on stm32
Case - grade sorting - TreeSet set storage
Solutions to conflicts between xampp and VMware port 443
Clause 30: be familiar with the failure of perfect forwarding
Clause 27: alternatives to overloading with familiar universal reference types
Jeffery0207 blog navigation
17.6 unique_lock详解
KVM virtualization management tool
Clause 33: decltype is used for auto & type formal parameters, with std:: forward
动态规划-最长公共子串
File descriptorfile description
C language learning log 12.5
float类型取值范围
Problems encountered in the use of PgSQL
Simple greedy strategy