Remove dependency on external http server for local viewing

This commit is contained in:
Damien Zammit 2020-05-05 10:42:28 +10:00
parent 13bd0fa765
commit 182a1f8dfc
2 changed files with 27 additions and 20 deletions

View File

@ -81,7 +81,7 @@ notes just in case you decide to anyway.
### Run it locally
You may want the manual available on a machine that doesn't have constant
internet access. You will need `git`, and `python3` installed.
internet access. You will need `git`, `python3` and `cherrypy` python module installed.
1. Download code and build manual
@ -91,29 +91,14 @@ internet access. You will need `git`, and `python3` installed.
./build.py
```
2. Install and configure a web server on your machine. Any web server should
work, Apache, nginx, etc... The following steps are for nginx, using another
server means following the same procedure for the server you decide to use.
3. Install [nginx](http://wiki.nginx.org/Install)
4. Configure nginx server block in `/etc/nginx/sites-available/default`
2. Run the following:
```
server {
listen 80;
server_name localhost;
root ...path_to_.../ardour-manual/website;
index index.html;
}
./servit.py
```
5. Restart nginx server
3. The manual will now be available at http://127.0.0.1:8080
service nginx restart
6. The manual will now be available at http://localhost
(Ctrl-c to quit the server).
### Helper scripts: `implode` and `explode`

22
servit.py Executable file
View File

@ -0,0 +1,22 @@
#!/usr/bin/python3
#
# Script to locally host the manual as a simple http site
import os
import cherrypy
PATH = os.path.abspath(os.path.dirname(__file__))
class Root(object):
pass
cherrypy.tree.mount(Root(), '/', config={
'/': {
'tools.staticdir.on': True,
'tools.staticdir.dir': os.path.join(PATH, 'website'),
'tools.staticdir.index': 'index.html',
},
})
cherrypy.engine.start()
cherrypy.engine.block()