From 99ff5c1c493b2fc70be25265c2549066dc1f681a Mon Sep 17 00:00:00 2001 From: yxjsolid Date: Tue, 15 May 2018 04:29:47 +0800 Subject: [PATCH] update --- build/webpack.dev.conf.js | 6 ++++++ flask_server.py | 31 +++++++++++++++++++++++++++++++ static/index.html | 15 +++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 flask_server.py create mode 100644 static/index.html diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index 212d081579..952e574567 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -23,6 +23,12 @@ const devWebpackConfig = merge(baseWebpackConfig, { // cheap-module-eval-source-map is faster for development devtool: config.dev.devtool, + output: { + path: path.resolve(__dirname, './hrm'), + filename: utils.assetsPath('js/[name].js'), + chunkFilename: utils.assetsPath('js/[id].[hash].js') + }, + // these devServer options should be customized in /config/index.js devServer: { clientLogLevel: 'warning', diff --git a/flask_server.py b/flask_server.py new file mode 100644 index 0000000000..359271773b --- /dev/null +++ b/flask_server.py @@ -0,0 +1,31 @@ +# /app.py +#!/usr/bin/env python +# encoding: utf-8 +from flask import Flask, render_template, redirect +from flask import Response +from flask import stream_with_context +import requests + +app = Flask(__name__) + +@app.route('/') +def index(): + print "index" + return app.send_static_file('index.html') + +@app.route('/static/js/') +def npm(filename): + print "xxxxxxxxxxx" + print filename + + url = "http://localhost:9528/static/js/%s"%filename + + req = requests.get(url, stream = True) + return Response(stream_with_context(req.iter_content()), content_type = req.headers['content-type']) + + # return app.send_static_file() + # return redirect('http://localhost:9528/static/js/%s'%filename) + +if __name__ == '__main__': + app.run(debug=True) + diff --git a/static/index.html b/static/index.html new file mode 100644 index 0000000000..4ed0506c8e --- /dev/null +++ b/static/index.html @@ -0,0 +1,15 @@ + + + + + Title + + + + +
+ + + + +