Reputation: 950
I have a python project working locally which runs under the UNIX command format of: python main.py arg1 arg2 etc.
I want to export my folder to the Google App Engine, so I did the small tutorial to make "Hello World" run on my App. I read the app.yaml file but can't seem to figure out how to add an app.yaml to my project that runs my Python command.
EDIT:
runtime: python27
api_version: 1
threadsafe: true
command: ["/bin/sh", "-c"]
args: ["python webXMLPARSER.py www.reitmans.com 2016-12-01 2016-12-08"]
Upvotes: 2
Views: 6995
Reputation: 39814
The short answer - you cannot do that.
The long one now.
GAE (standard) app code is not designed to run as a standalone app. It is merely a collection of config files and code snippets designed to work together with and complement the GAE infra code (live or SDK) in order to operate as an app.
To run the app locally one must do it through the SDK's development server, see Using the Local Development Server for details.
Also:
GAE apps are fundamentally web server apps, they get requests and return responses, they don't actually execute arbitrary python cmds. Your attempted config is invalid, see app.yaml Reference.
the GAE sandbox has significant restrictions when it comes to what the app can do, in particular launching other processes is not allowed. See The sandbox.
Upvotes: 2
Reputation: 2014
First, you have to instruct to run a shell, and then pass arguments to the shell like python something.py args1 args2.
command: bash -c "python something.py args1 args2"
You should try Dockerfiles1, they have a more intuitive way of running commads:
CMD ["python", "something.py", "args1", "args2"]
Upvotes: 2