Migrating blog to nikola + GAE
This blog has been in deep lethargy for several years. I’m not sure I can make it come back to life, but I’ll try, first of all by explaining how I managed to migrate it from blogger to static site hosting generated by nikola and hosted on GAE (Google app engine).
Import in Nikola¶
Nikola proposes the plugin import_blogger
which allows you to
import an XML export file of blogger into the nikola file structure.
You may install it with:
A nikola project is then created with the command:
Then copy the generated configuration file (e.g. conf. py. import_blogger-20171228_142937
) to the file conf. py
and modify the configuration according to your wishes.
Blog article files are generated in html format with a . meta file in restructuredtext format containing the article’s metadata.
Overall the conversion goes well and the rendering is acceptable. However,
some articles require some tweaking. I get them through the tools:
pandoc
and html2text2
to get a version of the article in
restructuredtext format to be taken up and modified by hand:
Hosting on GAE¶
Google provides pretty detailed explanations for hosting a static blog on GAE. Applied to a static blog generated by Nikola, you need to:
Create a project on the console google cloud.
-
Put the file
app. yaml
in the following directoryfiles
at the root of the project: -
Change the parameter
DEPLOY_COMMANDS
in the fileconf. py
as follows (replacinggae_project_id
with the identifier of the project created in 1.:
It is probably possible to use PRETTY_URLS
by modifying the file
app. yaml
to take by default the files index. html, but this
configuration allows to keep the same URLs as on blogger if you configure
the redirection for the old URLs:
Or even more simply, as @GetNikola very kindly pointed out to me on twitter, by replacing posts
with ""
in the variable POSTS
:
POSTS = ( ("posts/*.txt", "", "post.tmpl"), ("posts/*.rst", "", "post.tmpl"), ("posts/*.html", "", "post.tmpl"), )
Then a simple nikola build && nikola deploy
will make the site
accessible on the URL https://gae_project_id. appspot. com. You are free to
configure your DNS registration so that your domain name redirects to this
page. You can also configure the automatic generation and renewal of
certificates to make your site accessible in HTTPS. This is easily done on
the google cloud console.
Comments