Skip to main content

A plugin for lektor to deploy to qiniu cloud, Use qiniu://<bucket>[/name_of_dir] to deploy to a bucket

Project description

lektor-qiniu Lektor CMS 七牛云插件

lektor-qiniu is a plugin to deploy your lektor site to a qiniu cloud bucket.

简体中文说明

Main Features

  1. deploy your site to your qiniu bucket
  2. deploy your site to a folder in a qiniu bucket
  3. exclude files and directories from deployment.
  4. refresh your qiniu cdn.

Before Installation

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.

Go to 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.

Installation

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.

Usage

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.

Configuration

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 =  

Credentials

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.

exclusions

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:

新风网 Intersonic Group F&S Always Auto Parts THEORING Seal Rings THORING 密封圈

Looks pretty good, right? Thanks for lektor, you can try this best Static CMS as well via Lektor CMS Official Site

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

lektor_qiniu-0.1.3-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file lektor_qiniu-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: lektor_qiniu-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.3

File hashes

Hashes for lektor_qiniu-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 986827cb1c1d454ffa80e4890c154e89909a6f2c9f898aafb323a38257f602dd
MD5 0c3bfff6d1edc3f175c62e150b714542
BLAKE2b-256 33d5f3d1839728671ba9816ce5a2aaaaeec928d7763be8b97181fbd7da9a02f3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page