I have an App Engine app contains 3 modules and a dispatch.yaml. It works perfectly in production, however on the dev server (using GAE Launcher) only the default module is loaded.
The command which is run by the launcher:
Running command: "['D:\\Python27\\pythonw.exe', 'D:\\Program Files (x86)\\Google\\google_appengine\\dev_appserver.py', '--skip_sdk_update_check=yes', '--port=10081', '--admin_port=8002', 'D:\\path\\to\\my\\app']"
I know that when running dev_appserver.py using the command line it is possible to specify all modules as arguments. Is there a way of doing it when using the Launcher?
I believe this is done the same way as you do for an IDE like PyCharm, where you pass the yaml files (for each module) in the Extra Flags section.
Double-click the instance in App Engine Launcher
Under Extra Flags, add all the yaml files for your modules, separated by a space "app.yaml app2.yaml app3.yaml"
Bardia's answer is correct. However, after experiencing the problem myself and speaking with a GAE support engineer, I've added some further details. This information is currently missing from the official GAE documentation, but Google are planning to add it soon.
To use Google App Engine Launcher to 'Run' or 'Deploy' an application that uses modules you first need to:
Double click the application in Google App Engine Launcher, to bring up the Application Settings window.
Under Extra Flags, list the yaml files separated by spaces. Specify the full file path. If you are using a routing file, dispatch.yaml, list it first. Don't include app.yaml as this is already included by default.
e.g. /Users/.../dispatch.yaml /Users/.../app2.yaml /Users/.../app3.yaml
There is also a blog post, which explains how to do it, here:
http://www.shiftedup.com/2014/11/11/running-modules-locally-using-the-googleappenginelauncher-application
Update
Yaron commented that this method only works when you click the 'Run' button to run on localhost, but it doesn't work when you click 'Deploy' to deploy to production. I checked and I had the same problem, so I contacted Google support. They advised me that Google App Engine Launcher is now archived and is no longer supported. Instead we should use the new 'gcloud preview app deploy' command.
To deploy multiple modules, type the following into the command line:
gcloud preview app deploy ~/my_app/app.yaml \
~/my_app/another_module.yaml
Which is a shame, because I quite liked Google App Engine Launcher.
Related
Seems like google cloud's shell commands are super limited.
I can see docs about using appcfg.py to upload and download code from app engine, but what are the commands to just get basic info about it?
Is there a list services command? Or a get running versions command? I still don't understand where the app engine code I upload lives.
What are the commands to just "poke" app engine stuff?
To get info about what appcfg.py can do:
$ appcfg.py help
Usage: appcfg.py help <action>
appcfg.py: error: Expected a single action argument. Must be one of:
...
list_versions: List all uploaded versions for an app.
...
$ appcfg.py help list_versions
Usage: appcfg.py [options] list_versions [directory]
List all uploaded versions for an app.
The 'list_versions' command outputs the uploaded versions for each module of
an application in YAML. The YAML is in formatted as an associative array,
mapping module_ids to the list of versions uploaded for that module. The
default version will be first in the list.
...
A bit newer than appcfg.py and the officially recommended one these days (but still not covering all the stuff from the Console) is the gcloud CLI from the Cloud SDK (and in particular the gcloud app submenu for GAE apps).
Your uploaded code lives in the cloud :) Donno exactly where, but you can see it in the Console's Debug page. Not directly accessible from the cloud shell's VM (AFAIK). If you want to access it in the cloud shell you need to download it from your app to your "cloud homedir" (using one of the 2 utilities).
As for "poking", you have to be very specific as different kinds of poking are done in different ways (many in the GUI only). Probably better to do it in a separate question (or questions).
I want to deploy my flask web application on Azure cloud. In Deployment options, I have selected GitHub as source destination for my flask code. after doing the configuration test successfully, the init.py file now starts building;
Now when I go to my application link, it shows me this;
Now at this point, I went back to my deployment options, it says Building failed;
the log generated for this building failed can be seen in the first picture. All the tests has passed except the last one "Performance test". Have anyone encountered the same issue before ? what can be the reason for that ?
I am running the application on localhost # port 8000.
from flask import Flask
app = Flask(__name__)
#app.route("/")
def hello():
return "Hello World!"
if __name__ == "__main__":
app.run()
Do I need to run it on another IP ?
You cannot listen on port 8000 in Web Apps. Only port 80 or 443. You'll need to read the port number from the environment, to know what to listen on.
If you created the Azure Webapp using the Flask tool, the default app is called FlaskWebProject1. If your app has a different name, you need to modify web.config in your wwwroot folder to reflect the correct app name.
Then redeploy using the Azure portal or change it in your GIT and push again.
Based on your 500 error, I think some python packages are not installed correctly.
To check your code is working correctly in naive manner, do as follows.
If you are developing on Windows machine, copy all of your site-packages files in development machine to WebApp /site/wwwroot/env/Lib/site-packages folder.
Hit Restart in Azure Portal and F5 in browser.
If it works, your deployment process might have a problem. Mainly it is caused by library installation.
First, check you have requirements.txt at the root folder. This documentation describes some considerations to load Flask on Azure WebApp. Of course, it would be really helpful to read the documentation from the first line carefully.
Second, login WebApp via FTP and check the package is installed correctly. You can see /pip folder has pip.log file, and /site/wwwroot/env/Lib/site-packages folder has its libraries.
For some libraries which you might require more than simple hello world app, you may have to push x86 .whl files along with python codes as they are not installed correctly in x86 environment.
Additionally, in order to show internal error to outside, consider to apply this option during development (not for production).
I have been added as developer on application.
On Applications Overview this app is shown together with my other app, that I can freely access and change via Google App Engine Launcher.
Question is how to get app I'm supposed to work on my computer locally(in other words in GAE), so I can test and change it locally in the browser on my computer...
Windows 7
App Engine SDK-release: "1.7.6"
API: python27
You can use the appcfg application (the one that handle uploads) to download the source code.
This only works if the administrator has not disabled it.
However, it would be better to ask the developpers to provide you with the original source code !
I'm trying to create a KhanAcademy (KA) clone on Google App Engine (GAE). I downloaded the offline version of KA (http://code.google.com/p/khanacademy/downloads/list) for Mac, and set it up with GoogleAppEngineLauncher (https://developers.google.com/appengine/). Because KA was produced on Python 2.5, I have the setup running through the Python 2.5 included in the KA offline version download, and I added these extra flags to the app (to essentially duplicate the functionality of the included Run file):
--datastore_path=/Users/Tadas/KhanAcademy/code/datastore --use_sqlite
As is, GAELauncher is able to get that up and running perfectly fine on a localhost. However, to get it up on my Google appspot domain, I need to change the application name in app.yaml. When I change "application: khan-academy" in app.yaml to a new name and try to run the local version via GAELauncher (or the included Run file), the site comes up but all the content (exercises, etc.) has disappeared (essentially, the site loses most of its functionality). If I try to "Deploy" the app in this state, I received a 500 Server Error when I try to go on the appspot website. Any ideas as to what could be going wrong?
Thanks.
The problem is that your 'clone' application does not have access to Khans Academy's AppEngine datastore so there is no content to display. Even if you do use all of the code for their application, you are still going to have to generate all of your own content.
Even if you are planning to 'clone' their content, too, you are going to have to do a lot of probably manual work to get it in to your application's datastore.
I've heard that other platforms support auto-deployment of their code to production when they push changes to their Git repository.
Can I set up something similar to this for AppEngine? How?
I'm using Python2.7 on Windows, and bitbucket as a repository.
Thanks!
Since app engine deploy is just a python script, why can't you just write a shell script that calls 'git push' followed by 'python appcfg.py deploy'?
Any bitbucket hooks that will send from bitbucket->appengine after you upload to app is probably a bad idea since it will require storing your app engine login credentials on github.
Other projects might have your app server pull from github/bitbucket. You can do this if your app engine site just serves static websites using http://drydrop.binaryage.com/, but you can't update actual running code this way.
Recently, App Engine added Push to Deploy features: https://developers.google.com/appengine/docs/push-to-deploy
It only has built in support for GitHub, but it might still be possible to configure BitBucket to work with it.