Is there some way I can run custom python code on my google appengine app online? Is there a python console somewhere that I can use? I've seen vague references here and there, but nothing concrete.
Check out these previous answers on how to enable the interactive console (that you can use on the local dev appserver) on your deployed application.
You can use remote shell, that is on your app engine sdk.
For example
~/bin/google_appengine/remote_api_shell.py -s your-app-identifier.appspot.com s~your-app-identifier
When you are inside the shell, you will have the db module enabled. in order to use your models, you will have to import them.
Related
I have been writing a pretty simple python quizz system (called game.py) and I am working to deploy it on heroku. The app functions exclusively within the confines of a python console, with no interface of any kind but that provided by a terminal.
As such, I would like to be able to have the application on Heroku simply be akin to what you obtain with a one-off dyno, available on the dashboard (or in a terminal with the CLI) with:
heroku run python game.py
The application works perfectly well in it's deployed form (exclusively from the Heroku git) and locally, but in order for the app to be available to a larger public, I would need to have such a console appear on the "https://[appname].herokuapp.com/" URL that you are given on deployment of the app.
Naively, I would think this to be unspeakably simple to pull off, but I have yet to find a way to do it.
The only reasonable thing I have found would have been to create a Procfile, but lacking any documentation on the commands available, I only have been able to try variations of:
web: run python game.py
Which doesn't create a web console. And:
web: bash
Which simply crash with error code h10, with no other information given.
Any help, any suggestion, any workaround you can think of would be extremely appreciated.
I'm developing a Python app for AppEngine using Eclipse / Pydev and need to debug with persistent data stored in the local NDB.
Now, the default path for the NDB on my Linux machine is /tmp and this gets discarded after each reboot. I couldn't find a way to tell Eclipse to use a custom path for the NDB, so I finally resorted to starting the dev_appserver.py via the terminal with:
dev_appserver.py --datastore_path=/home/myfolder/workspace/myapp_datastore app.yaml
Now when I start the debugger I really need persistent data to trace some tricky bugs, but as mentioned, I couldn't find a way to tell eclipse where to store the local NDB so as a consequence I can't use the debugger with persistent data.
Anybody knows a solution?
Tks!
Note: I'm a PyCharm, not an Eclipse user, the answer is based on info I saw.
A Run Configuration window with an Arguments tab allowing you to configure optional arguments for dev_appserver.py is mentioned in the (rather old) Cant Run Google appengine python app on eclipse although launcher works fine, but confirmed in 4.4. Run your application:
You still can use the command line to run your GAE application. But we
are now going to configure Eclipse to allow you to run your
application directly from Eclipse. Right-click on "todo.py", select
Run As ▸ Run Configuration. Under Main Module maintain the path to
dev_appserver.py.
Switch to the argument tab and maintain the full path name of your
project as a parameter. Put the parameter in double-quotes.
I agree, these are Run Configurations and you're asking about configuration for debugging the app. Well, at least in PyCharm they apply to running through the debugger as well, they're actually called Run/Debug Configurations.
Maybe the same applies to Eclipse as well, so IMHO it's worth to locate this tab in your Eclipse version and configure in it the arguments you desire, then check if they apply in the debugger.
I know that there are plugins to debugging python in vim like this one:https://github.com/joonty/vdebug
What I'm struggling is to find a way to debug GAE apps, is that even possible? If so what steps should I take to make it work?
Thanks
If you're running the GAE app locally with the development server, you should be able to debug the python runtime the same way that you'd debug other local processes.
You can't use vim to debug processes running on the Google runtimes in Google's datacenters. You might be able to use the Stackdriver Debugger to get stack traces; according to this page, the debugger is supported with Python on both the standard and the python-compat flex runtimes.
While using Google App Engine if there is an error in python the result is a blank page. It is difficult to debug python since you don't get line number on which there is error. It is extremely frustrating when you get blank page because of indentation error. Is there any way to execute python google app engine script in python interpreter so i get python error there itself.
If you are using the App Engine Launcher then by clicking on the Logs you can see all the logs and errors.
An alternative way is to start the development server via the command line (as it's already mentioned) and you will see all the logs there, which makes it much easier to work with because the Logs windows is not that flexible.
You can try to use the The Python Development Server.
dev_appserver.py myapp
Here is the documentation https://developers.google.com/appengine/docs/python/tools/devserver?hl=es
The situation is as follows: I have downloaded the Google App Engine SDK. I have written my "helloworld" app that runs locally in my computer. I have to use PyScripter as IDE. I can't use Eclipse, that would not be a valid solution to my problem.
In PyScripter, I have set a "Run Configuration", so that an instance of the server runs locally (either in "run" mode or in "debug" mode), and can access the app via a webbrowser accessing "localhost".
Now, the problem is, breakpoints seem to be ignored. I set a breakpoint, reload the browser, and the response appears without the debugger stopping at the breakpoint I had set in my own function. I cannot debug at all.
The question is, how can I debug the app using the configuration I have described?
(Note: I am already using the "remote" python engine within PyScripter for running the local server)
I think this is a PyScripter's bug. I tested in version 1.9.9.7 and the same problem is still there.