From 292df97183484a490a231068cb5e0dd408a80855 Mon Sep 17 00:00:00 2001 From: Malar Kannan Date: Wed, 12 Jul 2017 12:10:24 +0530 Subject: [PATCH] added static python server --- .gitignore | 104 ++++++++++++++++++++++++++++++++++++++++++++++++ src/LexEdit.tsx | 19 +-------- walle-server.py | 11 +++++ 3 files changed, 116 insertions(+), 18 deletions(-) create mode 100644 walle-server.py diff --git a/.gitignore b/.gitignore index 41092e6..0a85a08 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,107 @@ yarn-debug.log* yarn-error.log* public/png + +# Created by https://www.gitignore.io/api/python + +### Python ### +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + +# C extensions +*.so + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +wheels/ +*.egg-info/ +.installed.cfg +*.egg + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ + +# Translations +*.mo +*.pot + +# Django stuff: +*.log +local_settings.py + +# Flask stuff: +instance/ +.webassets-cache + +# Scrapy stuff: +.scrapy + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +# Jupyter Notebook +.ipynb_checkpoints + +# pyenv +.python-version + +# celery beat schedule file +celerybeat-schedule + +# SageMath parsed files +*.sage.py + +# dotenv +.env + +# virtualenv +.venv +venv/ +ENV/ + +# Spyder project settings +.spyderproject +.spyproject + +# Rope project settings +.ropeproject + +# mkdocs documentation +/site + +# End of https://www.gitignore.io/api/python diff --git a/src/LexEdit.tsx b/src/LexEdit.tsx index 3276820..2ac2e04 100644 --- a/src/LexEdit.tsx +++ b/src/LexEdit.tsx @@ -9,24 +9,7 @@ import { } from 'semantic-ui-react'; const { Box } = require('reflexbox'); -const imageRoot = 'http://localhost:3000/png/'; - -// export const fieldMetaMap = { -// label: { lens: 'label[0]', type: 'text' }, -// unl: { lens: 'unl[0]', type: 'text' }, -// synset: { lens: 'lexprops[0].wnsynset[0]', type: 'text' }, -// guid: { lens: 'guid[0]', type: 'text' }, -// pos: { lens: 'pos[0]', type: 'select' }, -// image: { lens: 'image[0]', type: 'preview' }, -// relations: { lens: 'relations[0]', type: 'text' }, -// frame: { lens: 'syntacticprops[0].property[0]._', type: 'select' }, -// morphclass: { -// lens: 'lexprops[0].morphology[0].morph[0]._', -// type: 'select' -// }, -// stats: { lens: 'stats[0].property[0]._', type: 'text' }, -// lang: { lens: '$.id', type: 'select' }, -// }; +const imageRoot = '/png/'; export class LexEdit extends React.Component { public render() { diff --git a/walle-server.py b/walle-server.py new file mode 100644 index 0000000..239313c --- /dev/null +++ b/walle-server.py @@ -0,0 +1,11 @@ +from flask import Flask,send_from_directory +app = Flask(__name__,static_url_path='',static_folder='build') +import os + +@app.route('/static/') +def send_js(path): + return send_from_directory('build/static', path) + +@app.route('/') +def hello_world(): + return app.send_static_file('index.html')