.. title: Deploy Nikola through FTP .. slug: deploy-nikola-through-ftp .. date: 2017-12-14 11:30:45 UTC+01:00 .. tags: python, nikola, ftp .. category: blog .. link: .. description: .. type: text `Nikola `_ is shiped with a `simple deployment `_ mechanism and the possibility to easily deploy with GitHub. However, I am currently hosting my personal pages on Free server; the service is free and great but with no possibility to use either SSH (and ``rsync``) or Git. Therefore, the question of FTP deployment was raised for me. .. TEASER_END The solution I adopted is `LFTP `_ that is a file transfer line-command software to manage your file transfers over a variety of protocols, including FTP. First steps ----------- The first steps are quite easy: .. code-block:: bash lftp lftp :~> open ftp://user:password@ftp.server.com; You can then perform a number of basic tasks, both locally (with commands preceeded by ``l``) and remotely: .. code-block:: bash lftp user@ftp.server.com:/~> cd website lftp user@ftp.server.com:/website~> pwd user@ftp.server.com:/website lftp user@ftp.server.com:/website~> lpwd /home/user/localdir The ``mirror`` command allows you to realise copy *à la* ``rsync``, selecting only files that were modified: .. code-block:: bash lftp user@ftp.server.com:/website~> mirror --reverse Total: 35 directories, 96 files, 0 symbolic links Modifié : 5 files, 0 symbolic links 49669 octets transfered Deployment with Nikola ---------------------- Then, you just have to update ``conf.py`` and edit ``DEPLOY_COMMANDS``: .. code-block:: python DEPLOY_COMMANDS = { 'default': [ """lftp -c 'set ftp:list-options -a; open ftp://user:password@ftp.server.com; lcd ./output; cd ./website; mirror --reverse'""", ] } You can then use directly ``nikola deploy`` command!