Commit 48f10ddb authored by Nicolas Herbaut's avatar Nicolas Herbaut
Browse files

tamed jinja2 template through flask

parent e9c44f5c
from python:3.6-slim
RUN apt-get update && apt-get install tk-dev --yes --no-install-recommends && rm -rf /var/lib/apt/lists/*
COPY requirements-python3.txt /tmp/requirements-python3.txt
RUN pip install -r /tmp/requirements-python3.txt
COPY ./dist/Flow_Matrix_Web_page-0.0.3-py3.6.egg /tmp/Flow_Matrix_Web_page-0.0.3-py3.6.egg
RUN easy_install /tmp/Flow_Matrix_Web_page-0.0.3-py3.6.egg
COPY ./dist/*.whl /tmp
RUN pip install /tmp/*.whl
EXPOSE 5011
CMD flow-matrix --influxdb_host $INFLUX_DB_HOST
......@@ -20,11 +20,11 @@ install: clean
python setup.py install
build:
.venv3/bin/python setup.py bdist_egg
.venv/bin/python setup.py bdist_wheel
docker-build:
docker build . -t nherbaut/flowmatrix
push:
docker push nherbaut/flowmatrix
docker push nherbaut/flowmatrix
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from flask import Flask, render_template
from flask import Flask
from jinja2 import Environment, PackageLoader
from flowmatrix.flowlib import get_data_full, get_data
import argparse
import os
......@@ -18,18 +19,18 @@ parser.add_argument('--influxdb_database', type=str, help='database to used in t
args = parser.parse_args()
e = Environment(loader=PackageLoader("flowmatrix", "../flowmatrix/templates/"))
@app.route("/")
def data():
matrix, svg = get_data(args.influxdb_host, args.influxdb_port)
return render_template('index.html', data=matrix.to_dict(), svg=svg)
return e.get_template("index.html").render(data=matrix.to_dict(), svg=svg)
@app.route("/full")
def data_full():
matrix, svg = get_data_full(args.influxdb_host, args.influxdb_port)
return render_template('index.html', data=matrix.to_dict(), svg=svg)
return e.get_template("index.html").render(data=matrix.to_dict(), svg=svg)
app.template_folder = "/usr/local/lib/python3.6/site-packages/Flow_Matrix_Web_page-0.0.3-py3.6.egg/flowmatrix/templates/"
app.run(host="0.0.0.0", port=args.flow_matrix_port)
......@@ -2,6 +2,10 @@
from setuptools import setup
from setuptools import find_packages
with open("requirements.txt") as requirements_file:
install_requires = requirements_file.read().split("\n")
setup(
name='Flow Matrix Web page',
package=["flowmatrix"],
......@@ -13,22 +17,6 @@ setup(
scripts=['bin/flow-matrix'],
include_package_data=True,
zip_safe=False,
install_requires=[
"chardet==3.0.4",
"click==6.7",
"Flask==0.12.2",
"idna==2.6",
"influxdb==5.0.0",
"itsdangerous==0.24",
"Jinja2==2.10",
"MarkupSafe==1.0",
"numpy",
"pandas==0.21.0",
"python-dateutil==2.6.1",
"pytz==2017.3",
"requests==2.18.4",
"six==1.11.0",
"urllib3==1.22",
"Werkzeug==0.12.2"],
install_requires=install_requires,
packages=find_packages()
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment