I'm following this guide to set up and test Google Cloud SDK app engine: Installing App Engine with GCloud
I follow the guide until the "Your first App Engine webapp" section. At the end it says to run "dev_appserver.py ." I run this which prompts me to select a program to open the file. I pick python.exe in my python27 folder. a cmd prompt for python pops ups displays a ton of text then disappears unfortunately the box closes the instant the text appears so I cannot read it. If I go to the next step and open "http://localhost:8080/" it will not load. I assume because the python prompt is closing itself.
I am running python 2.7, I followed the instructions precisely, I tried reinstalling everything, shutting down computer, and going through it step by step again and I get the same problem.
What is causing this auto closing problem?
EDIT: It works if I run, in the GCloud SDK Shell: "python "C:\Users\ pathfile to dev_appserver.py..." instead of going directly to the directory running the .py file and choosing python. Its a way to do it, but not exactly user friendly to type out 8 folder directories.
I encountered the same problem. The solution below works for me. On windows command prompt write the following commands:
1 - cd C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin
2 - python dev_appserver.py "C:\path\of\your\project"
Related
I am currently trying to get a display window I made in html setup to work immediately when the pi is plugged in, without needing to type in command prompt codes everytime it is shutdown
The 3 commands I need are:
cd ~/Desktop/screen
python -m SimpleHTTPServer
chromium-browser --start-fullscreen http://localhost:8000
The first one directs to the location the files are in (index.html
and its supporters)
The second one starts the server in that location
The third one launches chrome in f11 mode, filling the entire screen and connected to the default location of SimpleHTTPServer
I have implemented this directly in the terminal and it works, but even just sticking this in a .sh file does not operate, let alone hooking the .sh into the backend. I was following this instructable: https://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/
The thing is only serving static content, and people only will access it with their eyes looking at the screen. (If chrome allowed access to local files, it would literally be opening an html document). I tried setting up a full server, but between me being new to linux, pi, and servers, that did not get far.
Any help getting this set up will be greatly appreciated.
I got it working. There needs to be an '&' at the end of SimpleHTTPServer
python -m SimpleHTTPServer &
Also, chromium cannot be booted at this point, as the screen has not been initialized by the pi yet (from what I read). Instead, go into chromium's settings and change the startup page to "localhost:8000"
final .sh file
#!/bin/sh
#!launcher.sh
#!navigate to home directory, then to here
#!launch simple python server
#!open chrome at localhost:8000
cd /
cd /home/pi/Desktop/screen
python -m SimpleHTTPServer &
cd /
you will need to open chrome manually, but upon opening, it will be on the correct page.
The rest of the instructions at https://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/ worked
I have spent hours banging my head against the wall on this one!
I am running Python 2.7.10 on a Mac. I have a few Python scripts that I have written which run inside the Atom editor.
I have been trying to run these scripts on a local web server to speed up development. I have tried MAMP (which just throws 500 Internal Server Errors), and now "python -m SimpleHTTPServer" which just displays the python code in the browser and doesn't seem to execute it.
I have chmod +x my .py files. I start the web server in the folder that contains the .py files.
Here is an example...
hello.py
print("hello world")
When I browse to http://localhost:8000/hello.py I get the raw code displayed in the browser.
print("hello world")
If I use terminal and enter "python hello.py" it runs and displays the correct output...
MacBook-Pro-3:folder dj$ python hello.py
hello world
I have tried dozens of tutorials and suggested solutions, but none seem to help. Am I missing something fundamental here?
Thanks!
D
The server that python -m SimpleHTTPServer (or, for future readers, python -m http.server on Python 3) spins will not execute any file. It is merely a server that serves files as the documentation suggests:
The SimpleHTTPServer module can be used in the following manner in order to set up a very basic web server serving files relative to the current directory.
In order to get a server that will actually execute Python code, you'll need to use another tool. I'd start with bottle or flask.
Hi there I'm trying to deploy my python app using Travis CI but I'm running into problems when I run the "travis setup heroku" command in the cmd prompt.
I'm in my project's root directory, there is an existing ".travis.yml" file in that root directory.
I've also installed ruby correctly and travis correcty because when I run:
"ruby -v" I get "ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]"
"travis -v" I get "1.7.7"
When I run "travis setup heroku" I get this message "The system cannot find the path specified" then prompts me for a "Heroku API token:"
What's the issue?
If you hadn't had Heroku Toolbelt setup to the $PATH environment variable during installation, here are some steps to check:
Check if Heroku toolbelt is set in PATH variable. If not, cd to your Heroku toolbelt installation folder, then click on the address bar and copy it.
Go to the Control Panel, then click System and Advanced System Protection.
Go to Environment Variables, then look for $PATH in the System Variables
After the last program in the variable, put a ; then paste in your Heroku CLI folder and click OK. (This requires cmd to be restarted manually)
Login to Heroku CLI
grab the token key from heroku auth:token
run travis setup heroku if the setup goes smoothly, you shouldn't get the command not found and prompt you for heroku auth key. It will ask that you want to encrypt the auth key (highly recommend) and verify the information you provided with the toolbelt and Travis CLI.
commit changes
you should be able to get your app up and running within your tests.
I'm trying to upload a simple "hello world" with google app engine (for python). Every time I do I get the following error
Error 404: --- begin server output ---
This application does not exist (app_id=u'sqeekytest').
--- end server output ---
I've checked and double checked that the app_id matches. I found a possible solution in the following thread however I am a complete noob at this and I'm not sure that I am doing this correctly.
This application does not exist (app_id=xxx)
It seems that the most common solution to this problem is to run appcfg.py update . --no_cookies. What I don't know is where I am running it. Is it in cmd, the python shell, the google cloud SDK shell that comes with the program? I've tried it a few different places and the only result I have gotten is the launching of pycharm. Either the solution is not working for me or I am doing something dumb (more likely). I cannot figure this out.
Thanks
Open a terminal or command prompt and cd to the directory of your project
$ cd path/to/project
Then from there do
$ appcfg.py update . --no_cookies
That assumes your app.yaml is in the root directory of your project. If it's in a different directory, specify it by
$ appcfg.py update /path/to/directory/where/app.yaml/is --no_cookies
It could be that appcfg.py is not in your PATH, in that case you could add it to the PATH or simply specify the location, also from within the root directory of your project.
$ path/to/google-cloud-sdk/bin/appcfg.py update . --no_cookies
This will open a webpage in a browser asking for permission and once you have given it it will automatically continue with the deploying process in the terminal/command prompt.
I set up a job that want to execute an action that open the local browser. I write it use the python script:
import webbrowser
if __name__=="__main__":
webbrowser.open("http://www.example.com")
Then,i click Build now button on jenkins dashboard, it can execute successful and show successful as a result at last. But nothing happen for browser.It's very wierd that other python script could execute correctly, I have no idea why?
Addition:This jenkins(Jenkins ver. 1.524) is installed on my laptop and my laptop's OS is Win7, i start jenkins as a Windows Service. Do u have any idea?
If you are running Jenkins as a Windows service, by default it runs as user Local System. Did you check the box titled "Allow service to interact with desktop"?. If that does not help you may have to set the service to log on as an actual user, instead of Local System. This is a common problem with running any process with a GUI from Jenkins.