Pages

Sunday, 24 November 2024

搭建基于go的静态相册程序moul

 先在本地系统上,安装go环境。(go1.12或更高)

fork这个项目https://github.com/moul-co/moul,我fork后的项目地址:

https://github.com/luckypoemster/moul

编辑https://github.com/luckypoemster/moul/blob/main/go.mod ,把第一行:

module github.com/moulco/moul 改为module github.com/luckypoemster/moul

然后,

go install github.com/luckypoemster/moul@latest

就会生成可执行文件moul.

$ moul create moul-collection (此命令会在当前目录下生成moul-collection目录)

显示:

Success! Created collection at `~\moul-collection`

■ Add your `cover`, `avatar`, and `collection`
into `moul-collection\photos\cover|avatar|collection`
■ Add your information in `moul-collection\moul.toml`

● Preview your photo collection: `moul preview`
● Export your photo collection: `moul export`

$ cd moul-collection

~/moul-collection$ moul export (此即生成/更新静态网站的根目录的命令)
■ Exporting photo collection... ⠁
● Success! Exported photo collection in `61.796ms`
~/moul-collection$ ls
dist/  moul.toml  photos/  

(生成了dist目录)

$ cd dist 

$ ls
assets/  index.html
(可见 ~/moul-collection/dist就是静态网站的根目录)

$ cd ..

$ cd photos

~/moul-collection/photos$ ls
avatar/  collection/  cover/

12799@DESKTOP-B6LK9IO MINGW64 ~/moul-collection/photos
$ cd cover 

~/moul-collection/photos/cover$ wget http://xyz.com/abc/somepic.jpg

$ cd ../collection

~/moul-collection/photos/collection$ (用wget或curl下载一些图片文件到当前目录下)

~/moul-collection/photos/collection$ cd ~/moul-collection

~/moul-collection$ moul export

演示网站:

https://stalwart-druid-e5c1c2.netlify.app/

https://mc-jhue17tz8-luckypoems-projects.vercel.app/

项目地址:https://github.com/luckypoemster/moul

 

 


 

 



 



 

No comments:

Post a Comment