biaslab/biaslab-hugo

issue w `make preview-website`

bertdv opened this issue · 9 comments

I got an issue w SimpleHTTPServer, see below

$ make preview-website
hugo -t academic-group
Started building site
0 draft content
0 future content
13 pages created
0 non-page files copied
0 paginator pages created
0 categories created
0 tags created
in 57 ms
cd ./public; python -m SimpleHTTPServer 8000
/home/bert/anaconda3/bin/python: No module named SimpleHTTPServer
make: *** [preview-website] Error 1

@bertdv It's due to the fact that SimpleHTTPServer was merged in the http.server module in Python 3. I'll update the Makefile tomorrow.

In the meantime you can edit the entry in the Makefile, substituting

python -m SimpleHTTPServer 8000

with

python -m http.server

or use hugo debug server. It's fine for testing/editing/viewing purposes, but having a separate server helps to catch some minor bugs and mistakes in the code, which hugo corrects for you.

Thanks, that runs indeed but I get an unformatted website at localhost:8000, see image below. BTW, shouldnt it be python -m http.server 8000? OTOH, make debug-website works fine.

fireshot capture 011 - biaslab - http___localhost_8000_

@bertdv what happens in that case is that config.toml by default contains the parameter baseUrl set up as http://example.org, which results in improper rendering of the website.

I have an idea about elegant solution to the problem and it's currently WIP.

This issue is resolved with pull request #3.

make preview-website still gives an unstyled output at localhost:8000

fireshot capture 49 - biaslab - http___localhost_8000_

@bertdv You should use command make-website-local if you want hugo to pick up the changes in local config file.

@bertdv Updating your theme: make update-theme might help as well.

After make update-theme and make preview-website-local I get the same unstyled output at localhost:8000 as shown in image above

setting baseurl in config.local.toml to 'http://localhost:8000' fixes this.