Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
yxjsolid committed May 14, 2018
1 parent 0d4667c commit 99ff5c1
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 0 deletions.
6 changes: 6 additions & 0 deletions build/webpack.dev.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
31 changes: 31 additions & 0 deletions flask_server.py
Original file line number Diff line number Diff line change
@@ -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/<filename>')
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)

15 changes: 15 additions & 0 deletions static/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>

</head>
<body>

<div id="app"></div>

<script src="//localhost:9528/static/js/app.js"></script>

</body>
</html>

0 comments on commit 99ff5c1

Please sign in to comment.