Reputation: 11
I have created a simple website using Google App engine + Python +Jinja2 and MySQL database. The website has one main page (index.html) rendered using Jinja2 from Python code and data is loaded from a MySQL database.
On the index.html page, I have created a horizontal menu (About, Home, Services, Products).
I want to load a new HTML page (say About.html) when I click About. Similarly, when I click Products, (I want to load Products.Html). Here I want to embed a pdf file.
I am not sure how to add these additional HTML pages. Can someone advise.
This is my App.yaml file.
application: ckappnotes
version: 1
runtime: python27
api_version: 1
threadsafe: yes
handlers:
- url: /stylesheets
static_dir: stylesheets
- url: .*
script: stn.app
libraries:
- name: jinja2
version: latest
I have added these lines to App.yaml.
- url: /
static_files: DTD.html
upload: DTD.html
- url: /
static_files: S1.pdf
upload: S1.pdf
Doing so is overriding my original index.html page.
Upvotes: 1
Views: 387
Reputation: 13158
Your url
entries need to be unique from each other. As you noticed, you have overridden your home page with url: /
. Instead, you need to create a single url
for each page like this:
- url: /DTD.html
static_files: DTD.html
upload: DTD.html
- url: /S1.pdf
static_files: S1.pdf
upload: S1.pdf
This is fine if you only have a few files, but you may want to use a Static File Pattern Handler:
- url: /page
static_dir: page
In this example, you put DTD.html and S1.pdf into a new folder named page
. Your index.html
file will reference them as /page/DTD.html
and /page/S1.pdf
. Then, when you want to add a third file, you don't need to change app.yaml, simply add them to the folder and use the same URL pattern.
Upvotes: 0