How to add multiple pages in Google App Engine? - google-app-engine

I'm a beginner on GAE and I was wondering if it was possible to add another page to it so the home page would be
"example.appspot.com"
and the second would be
"example.appspot.com/test"
I've already tried looking for something that helps but the answers aren't what I'm looking for.

Of course it is possible to add more pages. The configuration for defining the URL matchers depends on the language runtime that you are using.
For Java:
The deployment descriptor is a file named web.xml. It resides in the
app's WAR under the WEB-INF/ directory.
https://developers.google.com/appengine/docs/java/config/webxml
For Python:
A Python app specifies runtime configuration, including versions and
URLs, in a file named app.yaml
https://developers.google.com/appengine/docs/python/config/appconfig#Python_app_yaml_About_app_yaml

Related

Where is home directory in GCP app engine standard environment?

I have distributed the django web page to the app engine of the gcp standard environment, and now I want to distribute it including the marvinJS of chemaxon.
In order to use that app, you need to put the license in that path.
(home directory)/.chemaxon
However, I can't find the home directory of the distributed standard environment app engine.
Also, if you find it, how should you move the file?
App Engine standard is a packaged solution. You submit your code, it is compiled (if required) and packaged in a container (with Buildpack). You don't manage the environment, the home directory, the users,....
So, try to add your file in the root path of your code. You won't be able to put the file higher in the dir path..

Are Google App Engine deployed files private by default?

Excuse the naivety here, I'm new to GAE, and haven't been able to find much in the available literature / answers about the deployed filesystem's public status...
My question is quite simple:
Assuming a standard app.yaml config, are the files that get pushed to GAE with gcloud app deploy publicly inaccessible, unless exposed by (in the example of Node.js) an express endpoint?
I want to make sure sensitive data like key files (for reference in code) in our deployed bundle are not exposed, and that the local filesystem of a deployment is only accessible privately by the code itself.
Unless you work with the “static” files & dir directives no data should be made visible to outside users by Google.
Authenticated Admin users (youself) can see all files deployed to the server in the admin console unless you disable “code downloads” (which was available on legacy App Engine but seems to be removed now).

How do I deploy multiple versions of my app with routes using Google App Engine?

I have an AppEngine project on https://myproject.appspot.com and I would like to be able to supply different versions of myproject if I, let's say, want to break backwards compatibility. The convenient way would be to have something like this:
https://myproject.appspot.com/v2 --> version 2 of my myproject
https://myproject.appspot.com/v3 --> version 3 of my myproject
I know I can deploy custom versions by doing: gcloud app deploy --version=v3. However, how do I fix this routing? Apparently, the different versions get their respective URL:s as desribed here: https://cloud.google.com/appengine/docs/standard/go/how-requests-are-routed. The pattern is https://[VERSION_ID]-dot-[MY_PROJECT_ID].appspot.com. This means that I would have https://v2-dot-myproject.appspot.com and https://v3-dot-myproject.appspot.com.
So, how do I do the routing? AFAIK I can't add this to dispatch.yaml. There I can only route to services and not versions or exact URLs.
The https://[VERSION_ID]-dot-[MY_PROJECT_ID].appspot.com format is the preferred way to manage versions in GAE. This gives you get the ability to split traffic between versions, which is very powerful for canary testing or a/b split testing.
If you were really interested to have https://myproject.appspot.com/[version numbers] then you could just roll out one version of your app with https://myproject.appspot.com/v2 and https://myproject.appspot.com/v3 routes all in the same version, but then you won't be able to split traffic via GAE routing.
You don't have to do anything specifically to obtain this routing, GAE does it for you automatically.
Just deploy the way you mentioned and checkout the respective URLs.
Google has described it here: how-requests-are-routed
Page says request can be routed to specific url by adding version number to url like below
https://[SERVICE_ID]-dot-[MY_PROJECT_ID].appspot.com
If I have a project by named http://mycuteproject.appspot.com, then after reading above page I will think that a specific version can be accessed by http://20190705t200049.mycuteproject.appspot.com. But it is not like that, the url should be https://20190705t200049-dot-mycuteproject.appspot.com

Get source of Google App Engine published version

Can I download my App Engine source code from Google?
Update: Google appengine now allows you to download the code
Documentation here.
(Duplicating answer from the duplicate thread)
You can't - App Engine is not a source control system. There are handlers available that will let you download your source code directly, if you set them in app.yaml when you uploaded your app. They can't include files marked static, however, since they are uploaded to a separate location.
Probably not. However, you can create a wrapper script around appcfg.py which will archive your source code and upload it along with everything else, then make that archive available on a protected part of the site.
An example of that is here.

Deployment of static directory contents to google app engine

I've deployed my first GAE application and I am getting "TemplateDoesNotExist" exception at my main page. It feels like my static directory content is not uploaded to GAE.
Isn't it possible that I update (appcfg.py update myapp/) all my files including the static ones and run it standalone on myappid.appspot.com ?
by the way here you can see the problem:
http://pollbook.appspot.com
PS: my app works perfect locally
Your templates should not be stored in a directory that you refer to as "static" in app.yaml. Static directories are for literally static files that will be served to end users by the CDN without changing. These files cannot be read by the templating engine. It works locally because the dev_appserver does not precisely emulate the production server.
Put your templates in a different directory like /templates or something. You do not need to refer to this directory in your app.yaml.

Resources