Merge pull request 'Added CONTEXT_PATH option when running via docker' (#57) from di/DashMachine:add-context_path-option into master
Reviewed-on: https://git.wolf-house.net/ross/DashMachine/pulls/57 Awesome, good work!
This commit is contained in:
commit
cc4fbb46aa
11
README.md
11
README.md
@ -30,7 +30,16 @@ docker create \
|
||||
--restart unless-stopped \
|
||||
rmountjoy/dashmachine:latest
|
||||
```
|
||||
|
||||
To run in a subfolder, use a CONTEXT_PATH environment variable. For example, to run at localhost:5000/dash:
|
||||
```
|
||||
docker create \
|
||||
--name=dashmachine \
|
||||
-p 5000:5000 \
|
||||
-e CONTEXT_PATH=/dash
|
||||
-v path/to/data:/dashmachine/dashmachine/user_data \
|
||||
--restart unless-stopped \
|
||||
rmountjoy/dashmachine:latest
|
||||
```
|
||||
### Python
|
||||
Instructions are for linux.
|
||||
```
|
||||
|
@ -11,8 +11,8 @@ from dashmachine.paths import user_data_folder
|
||||
if not os.path.isdir(user_data_folder):
|
||||
os.mkdir(user_data_folder)
|
||||
|
||||
|
||||
app = Flask(__name__)
|
||||
context_path = os.getenv('CONTEXT_PATH', '')
|
||||
app = Flask(__name__, static_url_path=context_path + '/static')
|
||||
cache = Cache(app, config={"CACHE_TYPE": "simple"})
|
||||
api = Api(app)
|
||||
|
||||
@ -32,10 +32,10 @@ from dashmachine.error_pages.routes import error_pages
|
||||
from dashmachine.settings_system.routes import settings_system
|
||||
from dashmachine import sources
|
||||
|
||||
app.register_blueprint(main)
|
||||
app.register_blueprint(user_system)
|
||||
app.register_blueprint(error_pages)
|
||||
app.register_blueprint(settings_system)
|
||||
app.register_blueprint(main, url_prefix=context_path)
|
||||
app.register_blueprint(user_system, url_prefix=context_path)
|
||||
app.register_blueprint(error_pages, url_prefix=context_path)
|
||||
app.register_blueprint(settings_system, url_prefix=context_path)
|
||||
|
||||
|
||||
from dashmachine.rest_api.resources import *
|
||||
|
Loading…
x
Reference in New Issue
Block a user