啟動伺服器
觀看serve說明
執行
$ mkdocs serve --help
顯示
Usage: mkdocs serve [OPTIONS]
  Run the builtin development server
Options:
  -f, --config-file FILENAME      Provide a specific MkDocs config
  -a, --dev-addr <IP:PORT>        IP address and port to serve documentation
                                  locally (default: localhost:8000)
  -s, --strict                    Enable strict mode. This will cause MkDocs
                                  to abort the build on any warnings.
  -t, --theme [yeti|amelia|journal|material|slate|flatly|spacelab|readthedocs|mkdocs|simplex|united|cyborg|bootstrap|cosmo|cerulean|readable]
                                  The theme to use when building your
                                  documentation.
  --livereload / --no-livereload  Enable and disable the live reloading in the
                                  development server.
  -q, --quiet                     Silence warnings
  -v, --verbose                   Enable verbose output
  -h, --help                      Show this message and exit.
啟動伺服器
執行
$ mkdocs serve
顯示
INFO    -  Building documentation...
INFO    -  Cleaning site directory
[I 160305 18:32:17 server:281] Serving on http://127.0.0.1:8000
[I 160305 18:32:17 handlers:59] Start watching changes
[I 160305 18:32:17 handlers:61] Start detecting changes
觀看網頁
執行
$ lynx http://127.0.0.1:8000
或
$ firefox http://127.0.0.1:8000
更改 port
執行
mkdocs serve -a 0.0.0.0:8080
顯示
INFO    -  Building documentation...
INFO    -  Cleaning site directory
[I 160305 18:33:40 server:281] Serving on http://0.0.0.0:8080
[I 160305 18:33:40 handlers:59] Start watching changes
[I 160305 18:33:40 handlers:61] Start detecting changes
觀看網頁
執行
$ lynx http://0.0.0.0:8080
或
$ firefox http://0.0.0.0:8080
當 bind 「0.0.0.0」 可以從外部連進來。
更多參考
- MkDocs / Getting started