A plugin for lektor to deploy to qiniu cloud, Use qiniu://<bucket>[/name_of_dir] to deploy to a bucket
lektor-qiniu Lektor CMS 七牛云插件
lektor-qiniu is a plugin to deploy your lektor site to a qiniu cloud bucket.
- deploy your site to your qiniu bucket
- deploy your site to a folder in a qiniu bucket
- exclude files and directories from deployment.
- refresh your qiniu cdn.
You may need a bucket from qiniu cloud to deploy your lektor project. Qiniu Cloud provides 10GB storage and cdn for free, that should be enough for most small projects.
QINIU Cloud for more details.
This plugin does not do anything to help you create or configure qiniu account or bucket. You will have to make it done by yourself.
There ways to install plugin in Lektor, the easy ways is run below command in your project.
lektor plugins add lektor-qiniu
Press Enter and lektor will automatically download and install this plugin for you.
After Installation, open your lektorproject file, first it should have a section like this:
[packages] lektor-qiniu= 0.1.3
then below this section, you need add your bucket and folder(optional) as a target of a deploy server, like this:
[servers.qiniu] name = qiniu enabled = yes target = qiniu://<YOUR-BUCKET>
or if you want deploy your site to a folder in a bucket, mostly for backups, you can add server section as below:
[servers.qiniu] name = qiniu enabled = yes target = qiniu://<YOUR-BUCKET>/<NAME-OF-FOLDER>
for example, if you want to deploy your site to a bucket name "abcde", folder "fjhi", you will need to add a server section as below:
[servers.qiniu] name = qiniu enabled = yes target = qiniu://abcde/fjhi
after this you should see a server shows when you push the deploy button in your Lektor Admin Dashboard.
but still you will need just 5 minutes to configure this plugin to make it works.
After setup your target server, you need to configure the plugin to make it works.
Go to your project's configs folder, which should be in root directory of your project. this folder is where Lektor keep the configuration files of all plugins. If you can't find any configs folder in your project's root directory, you need create it.
In configs folder, create a configuration file exactly named qiniu.ini.
Attention: DO NOT name the configuration file with other names, otherwise this plugin will not work properly.
In this configuration file, you will need add few more sections, you can copy a sample configuration ini file from the sample_config folder, it looks like this:
[auth] Access_Key = replace_with_your_own_AK Secret_Key = replace_with_your_won_SK [cdn] refresh_enable = yes refresh_url = https://www.your-own-site.com/ [exclusions] dirs = .lektor files =
You need to get your own Access Key and Secret Key from Qiniu Admin Dashboard, and put them in the auth section.
Refresh cdn cache
mostly, Qiniu provides a free(with limitations) cdn for your bucket site, after you update your bucket file, the cdn wouldn't update automatically, therefore you will need to refresh your bucket site's directory (via your site's root url), for more details you can check Qiniu's documentation.
fortunately, you don't need to do refresh manually, you can just set the refresh_enable to yes in your cdn section, and change the refresh_url to your site's root url. this plugin will automatically refresh your cdn site after all files are uploaded.
Another function this plugin provides is exclude folders or files you want to upload during deployment.
To exclude files or folders, just put the name of the folders or files in the exclusions section of configuration file, separated each one with commas.
[exclusions] dirs = .lektor, dir1, dir2 files = file1, file2,file3
One special folder here is .lektor, which Lektor officially suggests that this folder should be exclude during deployment, therefore you should keep at least this one, unless you have other needs for this folder.
About Lektor CMS
Lektor CMS is one of my favorite static website generators, I have use this in production for several projects, you can see some of my sites as below:
Looks pretty good, right? Thanks for lektor, you can try this best Static CMS as well via
Lektor CMS Official Site
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size lektor_qiniu-0.1.3-py3-none-any.whl (5.1 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
Hashes for lektor_qiniu-0.1.3-py3-none-any.whl