Boilerplate Code
#main.py from flask import Flask from controllers.index import Index app = Flask(__name__) index = Index() index.register(app, route_base='/') if __name__ == '__main__': app.run(debug=True)
#controllers/index.py
from flask import render_template
from flask_classful import FlaskView, route
class Index(FlaskView):
def __init__(self):
super().__init__()
@route('/')
def index(self):
return render_template('index.html', data={'blogTitle':'ទូរទស្សន៍យើង'})
<!--templates/index.html-->
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>{{data['blogTitle']}}</title>
<script src="/static/scripts/jQuery.js"></script>
<script src='/static/scripts/index.js'></script>
<link href="/static/styles/index.css" rel="stylesheet">
<link href="/static/fonts/setup.css" rel='stylesheet'>
<link href="/static/images/site_logo.png" rel="icon">
</head>
<body>
ស្វាគមន៍មកកាន់កម្មវិធីគេហទំព័រ «ទូរទស្សន៍យើង»
</body>
</html>
GitHub: "https://github.com/Sokhavuth/ETV
Heroku: https://khmerweb-etv.herokuapp.com/

Comments
Post a Comment