Pelican - Using the make ftp_upload command
The process for creating blog posts for this site with Pelican is working pretty good. However, once the site was generated, the process was to launch my favorite FTP application, Filezilla. Then connect to the can of worms site and copy the content to the server.
That is rather a manual process... so, there's got to be an easier way!
When I set up Pelican, it created a "make" file that automates a lot of actions. You can find documentation about the make command on the Pelican site.
Typing the make command in the terminal reveals some of the power buried inside.
$ make
Makefile for a pelican Web site
Usage:
make html (re)generate the web site
make clean remove the generated files
make regenerate regenerate files upon modification
make publish generate using production settings
make serve [PORT=8000] serve site at http://localhost:8000
make serve-global [SERVER=0.0.0.0] serve (as root) to :80
make devserver [PORT=8000] start/restart develop_server.sh
make stopserver stop local server
make ssh_upload upload the web site via SSH
make rsync_upload upload the web site via rsync+ssh
make dropbox_upload upload the web site via Dropbox
make ftp_upload upload the web site via FTP
make s3_upload upload the web site via S3
make cf_upload upload the web site via Cloud Files
make github upload the web site via gh-pages
Set the DEBUG variable to 1 to enable debugging, e.g. make DEBUG=1 html
Set the RELATIVE variable to 1 to enable relative urls
ftp_upload sounds like just the thing I need!
So, opened the make file in my editor and filled out some FTP variables at the top of the file that need to be set.
- FTP_HOST=
- FTP_USER=
- FTP_TARGET_DIR=
Then I tried running the command:
make ftp_upload
It started well, prompted for my password, but then FAILED with this error.
Fatal error: Certificate verification: certificate common name doesn't match requested host name
The key part of the make file is actually running the lftp
command:
lftp ftp://$(FTP_USER)@$(FTP_HOST) -e "mirror -R $(OUTPUTDIR) $(FTP_TARGET_DIR) ; quit"
Back to the internet to learn more about lftp
and to search for the error.
This github site provided the clue I needed where "Arkham"
suggested using the command set ssl:verify-certificate no
Tried this manually and it did the trick. Turns out you can add the set ssl:verify-certificate no
command to a ~/.lftprc
file. Then when I ran the make ftp_upload
command, it worked
like a champ.
I notice that the lftp command runs slower than using Filezilla to upload the files. But, since I can just run the command and walk away, that is a big advantage.