Advertisement
Guest User

sourcecode

a guest
Jan 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.22 KB | None | 0 0
  1. // test.vue
  2. <template>
  3.   <h1> Test Render</h1>
  4. </template>
  5.  
  6. <script>
  7. export default {
  8.  
  9. }
  10. </script>
  11.  
  12. <style scoped>
  13.  
  14. </style>
  15.  
  16. // app.js
  17. import Vue from 'vue'
  18. import test from './component/test.vue'
  19.  
  20. new Vue({
  21.     el: '#app',
  22.     render: h => h(test)
  23. })
  24.  
  25. // index.html
  26. <!DOCTYPE html>
  27. <html>
  28.  
  29. <head>
  30.     <meta charset="utf-8" />
  31.     <meta http-equiv="X-UA-Compatible" content="IE=edge">
  32.     <title>Vue Testing</title>
  33.  
  34.     <!-- Javascript -->
  35.     <script src="https://cdn.jsdelivr.net/npm/vue"></script>
  36. </head>
  37.  
  38. <body>
  39.     <div id="app">
  40.     </div>
  41.  
  42.     <script src="(( url_for('static', filename='js/app.js') ))"></script>
  43. </body>
  44.  
  45. </html>
  46.  
  47. // app.py
  48. from flask import Flask, render_template
  49. from flask_cors import CORS
  50.  
  51. class CustomFlask(Flask):
  52.     jinja_options = Flask.jinja_options.copy()
  53.     jinja_options.update(dict(
  54.       block_start_string='{%',
  55.       block_end_string='%}',
  56.       variable_start_string='((',
  57.       variable_end_string='))',
  58.       comment_start_string='{#',
  59.       comment_end_string='#}',
  60. ))
  61.  
  62. app = CustomFlask(__name__)
  63. CORS(app)
  64.  
  65. @app.route('/')
  66. def index():
  67.     return render_template('index.html')
  68.  
  69. if __name__ == '__main__':
  70.     app.run(debug=True)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement