Boilerplate Code
#main.py import config from flask import Flask from index import Index app = Flask(__name__) app.secret_key = config.vdict['secret_key'] Index.register(app, route_base='/') if __name__ == '__main__': app.run(debug=True)
#index.py
import config, copy
from flask import render_template
from flask_classful import FlaskView, route
class Index(FlaskView):
@route('/')
def index(self):
vdict = copy.deepcopy(config.vdict)
return render_template('index.html', data=vdict)
<!--templates/base.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>
<link href="/static/styles/base.css" rel="stylesheet">
<link href="/static/fonts/setup.css" rel='stylesheet'>
<link href="/static/images/site_logo.png" rel="icon">
</head>
<body>
ស្វាគមន៍មកកាន់កម្មវិធីគេហទំព័រ «កាសែតយើង»
</body>
</html>
/*static/styles/base.css*/
*{
margin: 0;
padding: 0;
box-sizing: border-box;
}
a{
text-decoration: none;
color: blueviolet;
}
a:hover{
opacity: .7;
}
.region{
max-width: 1200px;
margin: 0 auto;
}
body{
font: 14px/1.5 Vidaloka, OdorMeanChey;
}
GitHub: "https://github.com/Sokhavuth/newspaper
Heroku: https://khmerweb-newspaper.herokuapp.com/

Comments
Post a Comment