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

Popular posts from this blog

Boilerplate Code

Adding Frontend Single Movie Template