烧瓶的资产储存
Lagring的Python项目详细描述
#烧瓶:用于烧瓶的资产存储
-烧瓶
-postgresql 9.4+
是的。将Flask应用程序配置为具有必要的配置选项:
参数意味着
--------------------
资产存储根目录的路径
资产URL根目录资产URL不变部分
1。创建存储实例:
`` python
来自lagring import flasklagring
storage.init廑app(app)
```
2。从“storage.entity”类中派生sqlalchemy模型:
``python
(PostgreSQL 9.4+)。
您可以通过重写“lagring.entity.asset_data_field”方法来更改名称。
3。在资产字段中输入一些内容:
``python
new_file=file()
db.session.add(new_file)
db.session.flush()
new_file.file='/some/local/path/filename'
db.session.commit()
````
`冲洗()`
在此之前。
4.然后您可以使用这样的资源:
`` python
除了基本的“asset”类之外,还有“imageasset”和“directoryasset”来存储更具体的内容,并在上传时进行一些处理(目前还没有相关文档,请参见代码)。
-烧瓶
-postgresql 9.4+
是的。将Flask应用程序配置为具有必要的配置选项:
参数意味着
--------------------
资产存储根目录的路径
资产URL根目录资产URL不变部分
1。创建存储实例:
`` python
来自lagring import flasklagring
```
2。从“storage.entity”类中派生sqlalchemy模型:
``python
(PostgreSQL 9.4+)。
您可以通过重写“lagring.entity.asset_data_field”方法来更改名称。
3。在资产字段中输入一些内容:
``python
new_file=file()
db.session.add(new_file)
db.session.flush()
new_file.file='/some/local/path/filename'
db.session.commit()
````
`冲洗()`
在此之前。
4.然后您可以使用这样的资源:
`` python
除了基本的“asset”类之外,还有“imageasset”和“directoryasset”来存储更具体的内容,并在上传时进行一些处理(目前还没有相关文档,请参见代码)。