[英]How to create directories/files on the local machine using Django?
I'm working on a blockchain project where I'm implementing a wallet using Django. A user logs in and get's to generate an address.我正在从事一个区块链项目,我正在使用 Django 实现一个钱包。用户登录并生成一个地址。 Now, I want to store the user's private key/public key pair in a file locally on the user's machine every time a user generates an address, and be able to read that file again in the next session (at the user's will).
现在,我想在每次用户生成地址时将用户的私钥/公钥对存储在用户机器本地的文件中,并能够在下一个 session 中再次读取该文件(根据用户的意愿)。 I'm doing this because the app itself is a supernode of the blockchain and all users are virtual nodes.
我这样做是因为应用程序本身是区块链的超级节点,所有用户都是虚拟节点。 All communication between users happen through the supernode, thus the wallet functionality isn't the core function of the app.
用户之间的所有通信都通过超级节点进行,因此钱包功能不是应用程序的核心 function。
Everything is working perfectly except I can't find a way to create files locally on the client's machine.除了我找不到在客户端机器上本地创建文件的方法外,一切都运行良好。 I've perused the Django documentation but I can't seem to find anything useful (maybe I'm not looking in the right place).
我仔细阅读了 Django 文档,但我似乎找不到任何有用的东西(也许我没有找对地方)。
Is there a way I can achieve that?有什么办法可以实现吗?
Note: I'm trying as much as possible to avoid JavaScript, and I don't want users to download/upload files manually.注意:我尽量避免使用 JavaScript,我不希望用户手动下载/上传文件。
Saveing data/files on the clients machine is restricted but modern browser for good (security) reason.出于良好(安全)的原因,在客户端计算机上保存数据/文件受到限制,但现代浏览器。 However there are Cookies ( https://www.w3schools.com/js/js_cookies.asp , https://docs.djangoproject.com/en/3.2/topics/http/sessions/ ) or html5 webstorage ( https://www.w3schools.com/html/html5_webstorage.asp ).
但是有 Cookies ( https://www.w3schools.com/js/js_cookies.asp , https://docs.djangoproject.com/en/3.2/topics/http/sessions/ ) 或 html5 webstorage ( 865205 (865205 ) www.w3schools.com/html/html5_webstorage.asp )。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.