HTML is much easier to maintain in App Engine if you use templates. Templates are way of storing you HTML code, it also has syntax to show your application data where you want it to be.
Django's templating engine is included in webapp2 framework.
Here is a sample code how to render html template:
Just remember to store your html file in the same folder.
Then you probably want to add CSS to your project? Create folder called css (or whatever you want to call it) and add it as a static directory to your app.yaml:
This will map your "physical" css directory into <project url>/css url.
Create your style.css file and refer it in index.html and you are done!
Django's templating engine is included in webapp2 framework.
Here is a sample code how to render html template:
import webapp2
from google.appengine.ext.webapp import template
class index(webapp2.RequestHandler):
def get(self):
self.response.out.write(template.render('index.html', {}))
app = webapp2.WSGIApplication([('/', index)])
Just remember to store your html file in the same folder.
Then you probably want to add CSS to your project? Create folder called css (or whatever you want to call it) and add it as a static directory to your app.yaml:
This will map your "physical" css directory into <project url>/css url.
- url: /css
static_dir: css
Create your style.css file and refer it in index.html and you are done!
<link href="css/styles.css" rel="stylesheet" type="text/css">
No comments:
Post a Comment