Use different welcome files for local and production - google-app-engine

We are running our web application successfully on the google app engine server.We are using index.html file
as a welcome file both in local and production environment. Now we want to use different welocme files for local and prtoduction.
I have seen the post: web.xml with different files in welcome-file-list
but will it work without having issues with ips?
May i know what is the procedure to do that? Any suggestions would be great.

A welcome file is only used when no other handler is matched. If you want to test your app starting from DevelopmentIndex.html, all you need to do is hit
.../DevelopmentIndex.html
on your development server.

Related

What is the easiest way to push a file on the GCP AppEngine?

To verify the ownership of a domain to a mail service, I need to put a file with a specific name for verification. Is there a better way than pushing it into my app source repository?
For security reasons you would have to put the file in your source and do a deployment to App Engine. If you’ve worked with a traditional web server in the past where you basically dump files into a folder and serve them this will be a bit of a change. The App Engine files are going to execute only. If you want to get in to adding other files on the fly you would need a Cloud Storage Bucket, but I don’t think that will do it for your domain verification.

Google Cloud App Engine - Edit 1 file

I am new at Google Cloud and I would like to know if there is a way to edit only one file inside of an App Engine application.
This is my problem:
I am migrating from a normal hosting to google cloud and I am having some problems with my PHP code, I am using the same version like locally but I am getting some error in the cloud, so I need to change 1 or 2 files, update them and test the app, so is there any way to change that file directly on the server? To deploy i am using this command:
gcloud app deploy
But it takes about 10 minutes to deploy so is too slow my testing. Any suggestions?
Thanks.
Leandro
For the standard environment the answer is no, you need to deploy a new version of the app to modify a file. So the advice would be - make the most of testing your app locally. See somehow related Google AppEngine - updating my webapp after deploy
For the flexible environment (possibly your case as you mentioned 10 min deployment time, typical for the flexible env) there might be stuff to try, but tedious, see Google AppEngine - updating my webapp after deploy
There is a way to edit directly into the instance.
ssh into your instance and then start shell on your running docker as guided in this url. https://cloud.google.com/appengine/docs/flexible/python/debugging-an-instance
After login you can see your php source files.
Basically you will not have any editor. So do
$> apt update
$> apt install nano
$> nano index.php // edit your files
you can see something like
There is no way to change 1-2 files on the server so that it would update the app. Deployment is the process of updating the live app. If you want some changes to be made to the app that is already deployed, you will have to redeploy - there is no way around it. This is why it is recommended to test the app locally before (re)deploying so that you are sure everything is working fine.
If locally everything works fine and issues start happening only when the app is deployed, this should be investigated further and I would advise you to open a new question and provide as much details as possible regarding the problems, including full stack trace of the error, related code parts, your app.yaml contents as well.

from development to production - uploading a webpage

First of all, I will excuse myself for possibly making vague questions.
I am a newby freelancer webdeveloper, and I recently created a webapplication which works fine on my own computer, running it on localhost.
More recently, using A2Hosting, i bought a domain and some server space, and my objective is to upload my application in order to make it online for anyone.
However, right now, I am having a few problems.
Specifically, I do not know how to upload my web application.
Basically, what I did was upload all the folders and files I had on my local machine into the server, and I was hoping that would work.
Unfortunatly, the server continues to display the "initial" site I uploaded. a simple, static, htlm file saying hello world. This file is the index.html that is inside the "www" folder.
The directory of the server is presented in the following figure.
My question is how do I make the server display the content of react/redux page, instead of the simple static html initialy uploaded.
I am not familiar with react however with Angular you would have to run through the same process on the server as you would to run the app locally but with the server variables in place of the local variables.
For example on angular I have to compile and run my front/back ends and ensure my database is also live for it to run at all otherwise nothing would work on the server .
Check what configs need changing to process the change from local to dev
Hopefully that is at least a little bit helpful, the below article should be useful to you.
https://medium.com/#baphemot/understanding-react-deployment-5a717d4378fd

mystery "welcome" app from web2py on google app engine

I'm deploying, for the first time, an app on google app engine.
It seems to have succeeded, however when I go to my apps url I'm directed to the traditional "welcome" page from the default installation.
I do not have a "welcome" app. nothing about "welcome" is listed in my routes.py file.
so why am I directed to myURL/welcome/default/index ?
I can't even type in the direct url that I know I want to access without an "invalid request" error.
This also only happens when I upload and run from appspot.com, when I use the local development engine things are fine.
According to the dispatching rules, if you go to a URL without specifying an application, it will default to the init application, and if not found, it will then look for the welcome application. Also, if you used the standard app.example.yaml configuration file when deploying, the welcome application would have been included in your deployment (see the GAE deployment section of the book).
not much of an answer, because I still don't know exactly how the routing occurred, however I had the web2py app in 2 locations. On my local machine and on the web hosting server. I had been uploading the version from the hosting server to GAE. This one was failing. When I uploaded the one from my local machine things started to work.
So I must have had a discrepancy somewhere between the two I just couldn't find.
You must call your application: "init" and deploy it in GAE.
For example, if you have developed yourweb2pyapp, your main page will be yourweb2pyapp/default/index and your main page in GAE would be yourGAEapp.appspot.com/yourweb2pyapp/default/index.
But if you write in your browser yourGAEapp.appspot.com you go to yourGAEapp.appspot.com/welcome/default/index and this is the problem.
The simplest solution is that you call your application "init" instead of yourweb2pyapp when you deploy it in GAE. So you new main, and default page will be yourGAEapp.appspot.com/init/default/index
You can pack yourweb2pyapp and then import it as init.
You have to be careful with the internal links.

Clean datastore for GoogleAppEngine

How to clear datastore in GoogleAppEngine.
I want to clear my development data to do a test again, but I can found a way to do that
If you are running from the commandline, use the --clear_datastore flag, e.g.,
dev_appserver.py --clear_datastore=yes app
Otherwise, if you're running it off the included GAE launcher, go into the settings of your app (double click it), and there should be a little checkbox that says "clear datastore on launch" under Launch Settings.
reference:
https://cloud.google.com/appengine/docs/python/tools/devserver#Python_Using_the_Datastore
dev_appserver.py --clear_datastore myapp
assuming by "development data", you mean the data in the dev server.
Simply use Administering Your Datastore (Experimental)
Some Other ways
App Engine: How to "reset" the datastore?
Delete all data for a kind in Google App Engine
Interactive console is also a great way.
For Java, the following information can be seen in Using the Datastore - Clearing the Datastore at the end of the page (as of 2013/05/10):
The development web server uses a local version of the Datastore for testing your application, using local files. The data persists as long as the temporary files exist, and the web server does not reset these files unless you ask it to do so.
The file is named local_db.bin, and it is created in your application's WAR directory, in the WEB-INF/appengine-generated/ directory. To clear the Datastore, delete this file.
So, stop your server, delete the file, and restart it up.
On your local machine you can go to : http://localhost:8080/_ah/admin/datastore

Resources