Showing
4 changed files
with
27 additions
and
20 deletions
| ... | @@ -14,13 +14,10 @@ | ... | @@ -14,13 +14,10 @@ |
| 14 | "lint": "gts lint", | 14 | "lint": "gts lint", |
| 15 | "clean": "gts clean", | 15 | "clean": "gts clean", |
| 16 | "fix": "gts fix", | 16 | "fix": "gts fix", |
| 17 | - "prepare": "npm.cmd run compile", | ||
| 18 | - "pretest": "npm.cmd run compile", | ||
| 19 | - "posttest": "npm.cmd run lint", | ||
| 20 | "compile": "tsc -w", | 17 | "compile": "tsc -w", |
| 21 | "build": "webpack --watch", | 18 | "build": "webpack --watch", |
| 22 | "start": "webpack serve --open", | 19 | "start": "webpack serve --open", |
| 23 | - "predeploy" : "webpack" | 20 | + "predeploy": "webpack" |
| 24 | }, | 21 | }, |
| 25 | "devDependencies": { | 22 | "devDependencies": { |
| 26 | "@types/node": "^14.11.2", | 23 | "@types/node": "^14.11.2", | ... | ... |
| 1 | <!DOCTYPE html> | 1 | <!DOCTYPE html> |
| 2 | <html lang="en"> | 2 | <html lang="en"> |
| 3 | <head> | 3 | <head> |
| 4 | + <base href="/" /> | ||
| 4 | <meta charset="UTF-8"> | 5 | <meta charset="UTF-8"> |
| 5 | <title>home</title> | 6 | <title>home</title> |
| 6 | </head> | 7 | </head> |
| 7 | <body> | 8 | <body> |
| 8 | - <div id="App"></div> | 9 | + <div id="App"> </div> |
| 10 | +<!-- <script src="public/main.js" ></script>--> | ||
| 9 | </body> | 11 | </body> |
| 10 | </html> | 12 | </html> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -5,7 +5,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin') | ... | @@ -5,7 +5,6 @@ const HtmlWebpackPlugin = require('html-webpack-plugin') |
| 5 | module.exports = { | 5 | module.exports = { |
| 6 | mode : 'development', | 6 | mode : 'development', |
| 7 | entry : { | 7 | entry : { |
| 8 | - // main : './build/src/index.js' | ||
| 9 | main : './src/index.ts' | 8 | main : './src/index.ts' |
| 10 | }, | 9 | }, |
| 11 | module : { | 10 | module : { |
| ... | @@ -23,7 +22,8 @@ module.exports = { | ... | @@ -23,7 +22,8 @@ module.exports = { |
| 23 | test: /\.(png|jpe?g|gif|jp2|webp)$/, | 22 | test: /\.(png|jpe?g|gif|jp2|webp)$/, |
| 24 | loader: 'file-loader', | 23 | loader: 'file-loader', |
| 25 | options: { | 24 | options: { |
| 26 | - name: 'images/[name].[ext]' | 25 | + name: 'images/[name].[ext]', |
| 26 | + publicPath: 'public/' | ||
| 27 | }, | 27 | }, |
| 28 | } | 28 | } |
| 29 | ] | 29 | ] |
| ... | @@ -32,8 +32,8 @@ module.exports = { | ... | @@ -32,8 +32,8 @@ module.exports = { |
| 32 | extensions: [".tsx", ".ts", ".js"], | 32 | extensions: [".tsx", ".ts", ".js"], |
| 33 | }, | 33 | }, |
| 34 | output : { | 34 | output : { |
| 35 | - publicPath: '/app/public', | 35 | + publicPath: '/public/', |
| 36 | - path: path.resolve('./public'), | 36 | + path: path.resolve('./public/'), |
| 37 | filename: '[name].js', | 37 | filename: '[name].js', |
| 38 | }, | 38 | }, |
| 39 | devServer : { | 39 | devServer : { |
| ... | @@ -46,7 +46,7 @@ module.exports = { | ... | @@ -46,7 +46,7 @@ module.exports = { |
| 46 | } | 46 | } |
| 47 | }, | 47 | }, |
| 48 | plugins : [ | 48 | plugins : [ |
| 49 | - new CleanWebpackPlugin(), | 49 | + // new CleanWebpackPlugin(), |
| 50 | new HtmlWebpackPlugin({ | 50 | new HtmlWebpackPlugin({ |
| 51 | template : './src/index.html' | 51 | template : './src/index.html' |
| 52 | }) | 52 | }) | ... | ... |
| ... | @@ -2,12 +2,8 @@ import os | ... | @@ -2,12 +2,8 @@ import os |
| 2 | from flask import Flask, render_template, request, jsonify, send_from_directory | 2 | from flask import Flask, render_template, request, jsonify, send_from_directory |
| 3 | from crawler.crawler_instagram import crawler_instagram | 3 | from crawler.crawler_instagram import crawler_instagram |
| 4 | 4 | ||
| 5 | -app = Flask(__name__) | 5 | +my_path = '/Users/choewonseog/Documents/check-your-instagram/app/public' |
| 6 | - | 6 | +app = Flask(__name__, static_folder=os.path.abspath(my_path)) |
| 7 | -@app.errorhandler(404) | ||
| 8 | -def page_not_found(): | ||
| 9 | - return render_template('404.html') | ||
| 10 | - | ||
| 11 | 7 | ||
| 12 | def update(insta_id): | 8 | def update(insta_id): |
| 13 | crawler_instagram(insta_id) | 9 | crawler_instagram(insta_id) |
| ... | @@ -18,16 +14,28 @@ def update(insta_id): | ... | @@ -18,16 +14,28 @@ def update(insta_id): |
| 18 | return jsonify(data) | 14 | return jsonify(data) |
| 19 | 15 | ||
| 20 | 16 | ||
| 17 | +@app.errorhandler(404) | ||
| 18 | +def page_not_found(): | ||
| 19 | + return render_template('404.html') | ||
| 20 | + | ||
| 21 | @app.route("/", defaults={"path": ""}) | 21 | @app.route("/", defaults={"path": ""}) |
| 22 | @app.route("/<path:path>") | 22 | @app.route("/<path:path>") |
| 23 | def home(path): | 23 | def home(path): |
| 24 | - # return render_template('index.html') | 24 | + print("hi? your in '%s' !!"%(path)) |
| 25 | + | ||
| 26 | + # if path != "" and os.path.exists(app.static_folder + '/' + path): | ||
| 27 | + # return send_from_directory(app.static_folder, path) | ||
| 28 | + # else: | ||
| 29 | + # return send_from_directory(app.static_folder, 'index.html') | ||
| 25 | if path == 'update': | 30 | if path == 'update': |
| 26 | insta_id = request.args.get('insta_id') | 31 | insta_id = request.args.get('insta_id') |
| 27 | update(insta_id) | 32 | update(insta_id) |
| 28 | - else : | 33 | + elif path == '' : |
| 29 | - return send_from_directory('./app/public/', 'index.html') | 34 | + root_dir = os.path.dirname(os.getcwd()) |
| 30 | - | 35 | + return send_from_directory(os.path.join(root_dir, 'check-your-instagram', 'app', 'public'), filename='index.html') |
| 36 | + return render_template('index.html') | ||
| 37 | + # else: | ||
| 38 | + # return render_template('index.html') | ||
| 31 | 39 | ||
| 32 | if __name__ == "__main__": | 40 | if __name__ == "__main__": |
| 33 | print("-" * 60) | 41 | print("-" * 60) | ... | ... |
-
Please register or login to post a comment