diff --git a/docs/about/release-notes.md b/docs/about/release-notes.md index 8f876d42..31692a44 100644 --- a/docs/about/release-notes.md +++ b/docs/about/release-notes.md @@ -21,6 +21,10 @@ The current and past members of the MkDocs team. * [@d0ugal](https://github.com/d0ugal/) * [@waylan](https://github.com/waylan/) +## Development Version + +* Bugfix: Override `site_url` with `dev_addr` on local server (#1317). + ## Version 0.17.0 (2017-10-19) ### Major Additions to Version 0.17.0 diff --git a/docs/user-guide/configuration.md b/docs/user-guide/configuration.md index b1b8a22a..4c0d5be2 100644 --- a/docs/user-guide/configuration.md +++ b/docs/user-guide/configuration.md @@ -347,16 +347,11 @@ true to halt processing when a broken link is found, false prints a warning. ### dev_addr -Determines the address used when running `mkdocs serve`. Setting this allows you -to use another port, or allows you to make the service accessible over your -local network by using the `0.0.0.0` address. +Determines the address used when running `mkdocs serve`. Must be of the format +`IP:PORT`. -As with all settings, you can set this from the command line, which can be -useful, for example: - -```bash -mkdocs serve --dev-addr=0.0.0.0:80 # Run on port 80, on the local network. -``` +Allows a custom default to be set without the need to pass it through the +`--dev_addr` option every time the `mkdocs serve` command is called. **default**: `'127.0.0.1:8000'` diff --git a/mkdocs/commands/serve.py b/mkdocs/commands/serve.py index 340a3f6f..11941158 100644 --- a/mkdocs/commands/serve.py +++ b/mkdocs/commands/serve.py @@ -103,7 +103,10 @@ def serve(config_file=None, dev_addr=None, strict=None, theme=None, theme=theme, theme_dir=theme_dir ) + # Override a few config settings after validation config['site_dir'] = tempdir + config['site_url'] = 'http://{0}/'.format(config['dev_addr']) + live_server = livereload in ['dirty', 'livereload'] dirty = livereload == 'dirty' build(config, live_server=live_server, dirty=dirty)