Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robnewman/bokeh-test
A test of the latest build of Bokeh (0.5.1) to show how autoload_static() fails
https://github.com/robnewman/bokeh-test
Last synced: about 1 month ago
JSON representation
A test of the latest build of Bokeh (0.5.1) to show how autoload_static() fails
- Host: GitHub
- URL: https://github.com/robnewman/bokeh-test
- Owner: robnewman
- Created: 2014-07-24T16:26:12.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-10-03T20:44:27.000Z (about 1 year ago)
- Last Synced: 2023-10-04T09:47:31.067Z (about 1 year ago)
- Language: Python
- Size: 223 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test to show how latest Bokeh release doesn't work as advertised
## What this repo consists of
* Sample script that starts up Flask microframework
* Sample Bokeh plotting script should draw a circle
* The circle plot should be visible in the `plot.html` template
* The `plot.html` template is rendered with a request to the root dir ('/')## How to run
* Assumptions: you have `virtualenv` and `pip` installed
* Build a virtual environment
```
$ virtualenv venv-name
```
* Activate the venv
```
$ cd venv-name
$ source bin/activate
```
* Clone the repo
```
$ git clone https://github.com/robnewman/bokeh-test
```
* Rename `bokeh-test` to `www`
```
$ mv bokeh-test www
```
* Change directory to `www`
```
$ cd www
```
* Load everything from REQUIREMENTS file with
```
pip install -r REQUIREMENTS.txt
```
* From the command line:
```
python run.py
```## What should happen
* Dynamically created JS files written out to
```
static-flask-bokeh/js/tmp/
```
* Dynamically created Bokeh plots displayed at root page
```
http://127.0.0.1:5000/
```## What does happen
* Dynamically created JS files written out to
```
static-flask-bokeh/js/tmp/
```
* Here is the directory structure after running the server and hitting it a few times:
```
$ tree static-flask-bokeh/
static-flask-bokeh/
├── css
│ ├── bokeh-0.4.min.css
│ └── bokeh.min.css.old
└── js
├── bokeh-0.4.min.js
├── bokeh.min.js.old
└── tmp
├── 167a9c91-9d9d-466c-ace7-b6f4f9c5834e.js
├── 3ea19b8f-3229-43b2-bfb8-9a7caf9ea5be.js
├── 48aaeb6c-59fb-4ff8-a67a-3c8cff7875ee.js
├── 70464b2b-5ecf-46f0-ae12-606c289da4c9.js
├── 8d276a60-4e85-42b0-a776-18e8d963fad6.js
└── 9cf0cb07-ce48-417e-b278-e9a740a6cdd7.js
3 directories, 10 files
```
* Flask server outputs 404 errors for the TMP js files```python
$ python run.py
* Running on http://127.0.0.1:5000/
* Restarting with reloader
Path: static-flask-bokeh/js/tmp/70464b2b-5ecf-46f0-ae12-606c289da4c9.js
Wrote 70464b2b-5ecf-46f0-ae12-606c289da4c9.js
127.0.0.1 - - [24/Jul/2014 09:19:08] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [24/Jul/2014 09:19:08] "GET /static-flask-bokeh/js/tmp/70464b2b-5ecf-46f0-ae12-606c289da4c9.js HTTP/1.1" 404 -
```* Looking at the HTML rendered (after another request to the page, so the JS files are new):
```html
Circle Plot Test
.bokeh_canvas_wrapper {
width: 10em !important;
}
.bokeh .btn-group {
margin-left: 9em;
}
Circle Plot
```
Look at the `` path. It is a relative link. If I click
on that link I see a 404 error. That shouldn't be.## What do I think the problem is?
Either Flask or Bokeh does not look in the specified TMP directory.
Looks like a `root_url` or `root_dir` problem in the Bokeh `Resources()` class?