在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:jeffbr13/django-ipfs-storage开源软件地址:https://github.com/jeffbr13/django-ipfs-storage开源编程语言:Python 95.4%开源软件介绍:django-ipfs-storageStore Django file-uploads on the Interplanetary File System. Uploads are added and pinned to the configured IPFS node, which returns the IPFS Content ID (a hash of the contents). This hash is the name that is saved to your database. Duplicate content will also have the same address, saving disk space. Because of this only file creation and reading is supported. Other IPFS users access and reseed a piece of content through its unique content ID. Differently-distributed (i.e. normal HTTP) users can access the uploads through an HTTP→IPFS gateway. Installationpip install django-ipfs-storage ConfigurationBy default To customise this, set the following variables in your
Set UsageThere are two ways to use a Django storage backend. As default backendUse IPFS as Django's default file storage backend: # settings.py
DEFAULT_FILE_STORAGE = 'ipfs_storage.InterPlanetaryFileSystemStorage'
IPFS_STORAGE_API_URL = 'http://localhost:5001/api/v0/'
IPFS_STORAGE_GATEWAY_URL = 'http://localhost:8080/ipfs/' For a specific FileFieldAlternatively, you may only want to use the IPFS storage backend for a single field: from django.db import models
from ipfs_storage import InterPlanetaryFileSystemStorage
class MyModel(models.Model):
# …
file_stored_on_ipfs = models.FileField(storage=InterPlanetaryFileSystemStorage())
other_file = models.FileField() # will still use DEFAULT_FILE_STORAGE Don't forget the brackets to instantiate FAQWhy IPFS?Not my department. See https://ipfs.io/#why. How do I ensure my uploads are always available?I don't know. Maybe look into using ipfs-cluster to spread it across a few nodes? Or perhaps you could integrate Eternum's hosted pinning service. How do I backup my uploads?See above. How do I delete an upload?Because of the distributed nature of IPFS, anyone who accesses a piece of content keeps a copy, and reseeds it for you automatically until it's evicted from their node's local cache. Yay bandwidth costs! Boo censorship! Unfortunately, if you're trying to censor yourself (often quite necessary), this means the best we can do is unpin the piece of content from your own IPFS node(s) and hope nobody else has pinned it. How do I securely expose my IPFS daemon's API to connect remotely?Someone please tell me. How do I securely expose my own IPFS←HTTP Gateway?Again, see above. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论