Added CONTEXT_PATH option when running via docker
This commit is contained in:
parent
43b82a16a7
commit
cd7158bca9
11
README.md
11
README.md
@ -30,7 +30,16 @@ docker create \
|
|||||||
--restart unless-stopped \
|
--restart unless-stopped \
|
||||||
rmountjoy/dashmachine:latest
|
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
|
### Python
|
||||||
Instructions are for linux.
|
Instructions are for linux.
|
||||||
```
|
```
|
||||||
|
@ -11,8 +11,8 @@ from dashmachine.paths import user_data_folder
|
|||||||
if not os.path.isdir(user_data_folder):
|
if not os.path.isdir(user_data_folder):
|
||||||
os.mkdir(user_data_folder)
|
os.mkdir(user_data_folder)
|
||||||
|
|
||||||
|
context_path = os.getenv('CONTEXT_PATH', '')
|
||||||
app = Flask(__name__)
|
app = Flask(__name__, static_url_path=context_path + '/static')
|
||||||
cache = Cache(app, config={"CACHE_TYPE": "simple"})
|
cache = Cache(app, config={"CACHE_TYPE": "simple"})
|
||||||
api = Api(app)
|
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.settings_system.routes import settings_system
|
||||||
from dashmachine import sources
|
from dashmachine import sources
|
||||||
|
|
||||||
app.register_blueprint(main)
|
app.register_blueprint(main, url_prefix=context_path)
|
||||||
app.register_blueprint(user_system)
|
app.register_blueprint(user_system, url_prefix=context_path)
|
||||||
app.register_blueprint(error_pages)
|
app.register_blueprint(error_pages, url_prefix=context_path)
|
||||||
app.register_blueprint(settings_system)
|
app.register_blueprint(settings_system, url_prefix=context_path)
|
||||||
|
|
||||||
|
|
||||||
from dashmachine.rest_api.resources import *
|
from dashmachine.rest_api.resources import *
|
||||||
|
Loading…
x
Reference in New Issue
Block a user