from what I understand, the app.yaml file in a Google App Engine project, can serve a file as a 'home' page. When I navigate to my domain, however, it always gives me a 404. My app.yaml is in the war directory. This is what my app.yaml looks like:
application: therealtest
version: 10
runtime: python
api_version: 1
handlers:
- url: /
static_files: site/index-static.html
upload: site/index-static\.html
What I am expecting it to do is to display the page index-static.html when I go to the domain of the site, but it does not. Is this not the correct way to do this? Thank you.
Is the site directory inside your war directory? It should be, given that is where you said your app.yaml file is.
FWIW, putting your web app in a war directory implies to me that you're thinking in Java terms, but your app.yaml snippet tells us you're using Python. In Java, WAR stands for Web Archive, which is a zip file with a certain required directories and files.
Related
I'm trying to provide a .well-known folder under my Google App Engine Application I'm using the standard environment and the python27 runtime.
with a web-app-origin-association.json file to try the Progressive Web Apps as URL Handlers
origin trial from chrome.
I've added the following code to my app.yaml file under handlers:
# .well-known Ordner
- url: /.well-known/(.*)
static_files: well-known/\1
upload: well-known/.*
The folder in my project is named well-known without a dot cause I've read that there are problems when using a folder Name with a dot at the start of the foldername.
But the url https://example.com/.well-known/web-app-origin-associate.json isn't available instead it works without the dot:
What do I have to change in order to make it work under https://example.com/.well-known/web-app-origin-association.json?
You can use the workaround documented at "Make skip_files rule explicit and tweak to allow .well-known/* to upload":
^(.*/)?\.(?!well-known(?:/|$)).*$
You many want to migrate to Python 3 as described in the guide:
Starting on January 1, 2020, the Python community will no longer
update, fix bugs, or patch security issues for Python 2.7. We
recommend that you update apps that are still running in the Python 2
runtime of the App Engine standard environment to the Python 3 runtime
as soon as possible.
The best way i found out about is to just do it like that:
- url: /\.well-known
static_dir: .well-known
secure: always
and use the python39 runtime.
We have a web application (frontend) using React created from Create React App. The app is running on Google Cloud Platform App Engine Standard. Our web application is code splitted. Each page is then loaded on user navigation.
It's working really well. The issue we have is for example user A is on the app home page. We deploy a fix that change the chunk file name. The user A then try to access another page and then got the error Loading chunk * failed. The url to get the file is now returning a 404 because the file has been replaced by some new chunk files.
It's a frequent problem as I can see during my research but I didn't find a solution that apply for Google App Engine.
Here's an article that explain the problem / solution: https://mitchgavan.com/code-splitting-react-safely/
I would like to use the solution "Solution 1: Keep old files on your server after a deployment" but I can't see how to do this using GCP ...
Here's the app.yaml file
service: frontend
runtime: nodejs14
env: standard
instance_class: F1
handlers:
- url: /(.*\..+)$
static_files: build/\1
upload: build/(.*\..+)$
- url: /.*
static_files: build/index.html
upload: build/index.html
We have the following dispatch file (* for masked url)
dispatch:
- url: "*"
service: frontend
- url: "www.*"
service: frontend
Haven't tried this before but see if it makes sense/works.
We have a blog article about downloading your source code from GAE. It contains an explanation of where your source is stored when you deploy (a staging bucket), how long it stays there and how you can modify how long it stays before Google automatically deletes it.
When you deploy to GAE, gcloud only deploys files that have changed (it doesn't deploy those that haven't). Since you now have 'new' files because new hashes were generated, the older files no longer exist on your local machine. I do not know if Google will automatically delete those files from the staging location in bullet 1 above.
My proposal here is that you follow the steps in the blog article (from bullet 1) and alter (change) how long the files are retained in your staging bucket. Another option is to check the retention policy tab and see if you can change the rule so the files don't get deleted. If you're able to alter how long the files remain or the retention policy, it just might solve your problem. Let me know if this works
I have an Angular site hosted in Google App Engine using the Python27 runtime in a standard env.
When someone visits my site www.site.com I want them automatically redirected to www.site.com/app. For reasons, I cannot do within the index.html file.
(For an explanation why and reason for doing so, see this question Renaming the index.html on Google App Engine)
In my app, I have tried things like
- url: /
mime_type: text/html
static_files: dist/app/index.html
upload: dist/app/index.html
expiration: 0s
For reasons that seem obvious to me now, this won't work as it does not rewrite the URL for the user. It doesn't seem there is a solution to rewrite rules similar to and .htaccess file. I understand this is arguably a better solution but not what I need to do right now.
Is there a setting in the Google App Engine that I am missing?
Is there an attribute in the app.yaml file that I am overlooking?
Thank you for your help
I have a folder called "test-my-app1" that includes my app for the google's app engine. This folder has a folder inside called img that stores all of my images for the CSS of my app, and also has a folder named profile. In the folder called profile ( test-my-app1/img/profile/ ) the user can upload a photo for his profile picture.
The php script that I use works successfully for the XAMPP that I have in my laptop. The problem is that when I run the script in app engine, image is not uploaded into my folder "profile". This is my app yaml file:
application: test-my-app1
version: 1
runtime: php
api_version: 1
handlers:
- url: /img
static_dir: img
- url: /profile/(.*\.(gif|png|jpg))
static_files: profile/\1
upload: profile/(.*\.(gif|png|jpg))
any idea how to fix it? there is a possible answer here : App Engine PHP upload file for my question but did not solved my problem
You need to upload files to Google Cloud Storage, the instructions on how to do this are here.
Once the files have been uploaded to Google Cloud Storage you can serve them in HTTP responses, follow the instructions here on using the Image serving service that allows for on the fly resizing, cropping and rotation.
You need to consider the filesystem where your application files are uploaded to as read only.
I'm getting an error "This webpage has a redirect loop" when loading my Google Apps Engine url: http://my-application-id.appspot.com (my real application ID in the url of course)
Google Apps Engine requires an app.yaml file in the root of the application directory to work correctly. Here are the contents of my file....
application: my-application-id
version: 1
runtime: php
api_version: 1
handlers:
- url: /.*
script: install.php
Is my app.yaml file setup correctly? The install.php file for my application works much the same way as a wordpress install.php file. You access it from a web browser and go through the basic setup. If my app.yaml file is correct, why am I still getting the "This webpage has a redirect loop" error displayed in my browser?
Also tried other browsers, clearing cookies, etc. The application installation screen loads perfectly in my SDK but not live on Google Apps Engine. What am I doing wrong?
I figured it out. There were 2 problems.
On app.yaml, in my case, the last line needed to say "index.php" instead of "install.php" Second, in my case, my configuration.ini file had port "80" set for MYSQL when in fact it needed to be "3306"