Join Club ShowMeDo to Learn Python!

This series is a part of Club ShowMeDo. Click to learn why you should join our club with a simple monthly subscription.

  • We teach Python and all the cool modules
  • Topics include beginner Python, GUIs, Web and Desktop Apps
  • Long, specially crafted video tutorials just for you
  • Club video tutorials extend our normal Free content
  • Save your time - we've done the research for you
  • Keep your skills up-to-date
  • Learn at your own pace, everything you need is shown to you
  • Over 12 hours of archived material are waiting for you in the club

Name: [008] Kyran Dale
Member: 105 months
Authored: 16 videos
Description: I'm one of the co-founders of Showmedo and an academic researcher by profession. My peripatetic path has taken me from a Philosophy degree via Artificial Intelligence and Evolutionary Robotics to a PhD in Neuroscience. I spent five years in a small room with a colony of reluctant bumble-bees, becomi ...

Installing the Python SDK and a 'Hello World' demonstration [ID:719] (2/5)

in series: A Gentle Introduction to the Google App Engine Python SDK

(Showmedo is undergoing major changes. To report any problems viewing the videos please email us and include browser and OS specifics. Cheers - Kyran.)

This video shows how to install the Google App Engine SDK and sets the context for the upcoming demonstrations. I explain what is meant by Common Gateway Interface (CGI) and show how to produce a simple 'Hello World' web-page with the SDK's web-server running on a local machine (localhost).

For a look at some real Python CGI coding, using the inbuilt CGI module, see John's rather cool club series. It's a very solid, ground-up introduction to Python web-development.

# A simple 'Hello World' demonstration

#app.yaml config script:

#application: helloworld
#version: 1
#runtime: python
#api_version: 1

#handlers:
#- url: /.*
  #script: helloworld.py

print 'Content-Type: text/plain'
print ''
print 'Hello, world!'

Got any questions?

Get answers in the ShowMeDo Learners Google Group.

Video statistics:

  • Video's rank shown in the most popular listing
  • Video plays: 334 (since July 30th)
  • Plays in last week: 0
  • Published: 76 months ago

Thank-yous, questions and comments

If this video tutorial was helpful please take some time to say thank-you to the authors for their hard work. Feel free to ask questions. Let the author know why their video tutorial was useful - what are you learning about? Did the video tutorial save you time? Would you like to see more?

You may also want to see our ShowMeDo Google Group to speak to our active users and authors.

Your email address will not be published.

Show some quick comments >>








All comments excluding tick-boxed quick-comments

17. anonymous Thu, 24 Dec 2009 22:35

i need python editor to write program on window xp please help me ?


I was having trouble with getting app engine web server running. Your video was linux based when many people will be doing this in windows. The provided instructions in this area are extremely poor. (at least I thought so)

At least your video gave me a few hints at what to try and I got it working.

Thanks, Fred


14. anonymous Thu, 02 Oct 2008 15:16

quant, thanks for that about the backslash. ridiculous. but solved my problem.


Hi Hamish

Now my server is working. It is both what i type below AND use of notepad to configure the .yaml file.

1) First thing, use the " " at the end of the path

See this from

http://markmail.org/message/sva5ba4zhlqsvtpb#query:dev_appserver.AppConfigNotFoundError+page:1+mid:5e4zusyj34gv2izf+state:results

You have a few problems: you are putting a spurious backslash on the end of the path name. Sometimes this doesn't matter, but sometimes it stops dev_appserver.py working correctly (and gives you the AppConfigNotFound error). The other problem is that you are using a path with a space in it so you need to enclose the path in quotes (otherwise the program thinks you've given it too many arguments and you get the Invalid Arguments error). Also putting your application inside the google_appengine folder sounds like a very bad idea (are you certain that upgrading the appengine software isn't going to delete your code?)

This should work:

C:\Program Files\Google\google_appengine>dev_appserver.py "C:\Program Files\Google\google_appengine\helloworld"

This is simpler:

C:\Program Files\Google\google_appengine\helloworld>.. \dev_appserver.py .

And this is what you should probably do:

C:\Program Files\Google\google_appengine>mkdir C:\myapps C:\Program Files\Google\google_appengine>move helloworld C:\myapps C:\Program Files\Google\google_appengine>cd \myapps\helloworld C:\myapps\helloworld>set PATH=%PATH%;c:\Program Files\Google \google_appengine C:\myapps\helloworld>dev_appserver.py .

2) I copied the .yaml file from the new_project_templates installed in the google sdk into my directory and modified it. (which makes me think notedpad is somehow screwing this up)

MY FINAL OUTPUT:

C:\Program Files\Google\google_appengine>dev_appserver.py "C:\Program Files\Goog

le\google_appengine\ramaprojects\helloworld"

INFO 2008-07-03 17:15:35,671 appcfg.py] Server: appengine.google.com

INFO 2008-07-03 17:15:35,687 appcfg.py] Checking for updates to the SDK.

INFO 2008-07-03 17:15:35,780 appcfg.py] The SDK is up to date.

WARNING 2008-07-03 17:15:35,780 datastore_file_stub.py] Could not read datastor

e data from c:\docume~1\01-adm~1\locals~1\temp\dev_appserver.datastore

WARNING 2008-07-03 17:15:35,780 datastore_file_stub.py] Could not read datastor

e data from c:\docume~1\01-adm~1\locals~1\temp\dev_appserver.datastore.history

INFO 2008-07-03 17:15:36,046 dev_appserver_main.py] Running application new-

project-template on port 8080: http://localhost:8080

Hope that helps. Let me know if I can help you in any other way.

Regards

Quant


Hi guys,

sorry about your troubles - as mentioned to Hamish off-comments, I installed GAE on a windows XP machine and it worked perfectly first time. At this point I can only conclude that this is a windows+GAE issue. The likely candidates are:

1. syntax error - files are incorrectly named - watch suffixes as windows has an annoying habit of hiding appended '.txt's

2, path error - either incorrectly referencing a file relative to the current directory or for some reason the XP environment variable 'Path' has not been set properly. From memory, not using windows on a daily basis, some of the later service packs prevent changes to the environment variables. If you type 'set' at the windows console prompt you should see that the 'Path' variables includes '[...];C:\Program Files\Google\google_appengine\'

if it doesn't this could be the source of the mixup. Just a thought. I'll see if I can turn up some stuff but without access to a 'broken' box it's hard to diagnose the problem.

kyran


@quant: After uninstalling and reinstalling GAE, and making sure app.yaml is correctly configured etc. I am getting exactly the same error message as you, i.e. <dev_appserver.AppConfigNotFoundError>, including the exact same line reference numbers you list as well.

Check out this string of other WIndows users with the same problem here...

http://code.google.com/p/googleappengine/issues/detail?id=57

Have a look at the solution offered at the link in comment #4. Let us know if this works for you.

It has NOT worked for me.

You can also try checking out more of the google results from a search of <dev_appserver.AppConfigNotFoundError>

I am still trying stuff - let us know if you get lucky!

Hamish


Hi Kyran

Thanks for the video. However I am trying to work this on windows and seem to be getting the same error as hamish. The error is as follows

C:\Program Files\Google\google_appengine>python dev_appserver.py /ramaprojects/h

elloworld

Traceback (most recent call last):

File "dev_appserver.py", line 50, in <module>

execfile(script_path, globals())

File "C:\Program Files\Google\google_appengine\google/appengine/tools/dev_apps

erver_main.py", line 351, in <module>

sys.exit(main(sys.argv))

File "C:\Program Files\Google\google_appengine\google/appengine/tools/dev_apps

erver_main.py", line 300, in main

config, matcher = dev_appserver.LoadAppConfig(root_path, {})

File "C:\Program Files\Google\google_appengine\google\appengine\tools\dev_apps

erver.py", line 2450, in LoadAppConfig

raise AppConfigNotFoundError

google.appengine.tools.dev_appserver.AppConfigNotFoundError

Could you please let me know what I am doing wrong?

Regards

Quant


Thanks for your comprehensive reply, Kyran.

I will do as you mention, and then e-mail you back so as not to hog the public comments section.

However, the more I research GAE on online groups, the more it seems that a number of Windows users are often having similar trouble - probably as a result of most developers being on Unix/Linux or Mac so Windows trouble simply isn't caught.


hi hamish,

sorry that you're having such difficulties. It's always hard to know where to pitch this type of series. Some familiarity with running Python from the command-line and working with text-files was assumed. I think I mention in the video that the choice of where to unpack GAE is up to you, but in Windows this will be automatically placed in 'program_files/google' (from memory).

So, from the top:

1/ open a console (cmd-line), and go to the head directory where GAE was installed. As I mentioned in the video, with linux I got to place it where i wanted - in windows you can copy the directory to a more convenient location. btw - i've always found dos pretty horrible - you can find ready-to-run versions of the unix commands here http://unxutils.sourceforge.net/

2/ typing ls (or dir in windows) should show this:

kyran@bandersnatch:~/screencasts/google_appengine$ ls

appcfg.py demos google LICENSE projects templates VERSION

BUGS dev_appserver.py lib new_project_template README tools

the projects directory was created by me and contains the directory helloworld in which are the files app.yaml helloworld.py (you can find these above in the source-file for this video). Just cut and paste these into a text editor and save in the helloworld directory.

3/ You need to run dev_appserver.py from its container directory thus for python to 'see' it:

kyran@bandersnatch:~/screencasts/google_appengine$ python dev_appserver.py projects/helloworld/

giving projects/helloworld as an argument. If this doesn't work it sounds as if you are having problems with your python installation. In order to help further i'd need to see what errors you are getting.


24 hours later, searching the web for GAE troubleshooting, I have isolated the problem to the Google Web App Server not opening (even with helloworld.py and app.yaml both situated in the helloworld directory).

Have tried using cmd line in Windows and Python, with heaps of variations in the path for good measure. No go.

I found a blog that suggested to run the dev_appserver.py script by placing it inside my "helloworld" directory with a "." added to call all files in there, i.e. <dev_appserver.py .> But still no go.

Any help would be much appreciated!

Hamish.


This video is not clear in critical parts.

@ 3:32 a little "magic" takes place. Inside the "newly created" Projects/Hello World directory are already sitting five files, including app,yaml and helloworld.py. Would be nice if the why and how of creating those files was shown.

@ 3:48 Where did that Console Window come from? and where is "/screencasts/google_appengine"? or is there an alternative way to view the files like this?

@ 6:20 The dual screened Console Window is referred to again. How do you read the yaml doc contents without this Console??

@ 8:48 "Shell" is opened up again - where is this shell from? Is it just the the same functionality as cmd line in Windows?

I went to Googles GAE explanation for "Hello World", and created the helloworld.py, but no help on creating the app.yaml config file -- e.g. what kind of file can that be created in the first place? GAE seems to assume relevant knowledge of Yaml etc... I went to Yaml.org and downloaded PyYaml, but that has not helped.

I tried copying across to the new HelloWorld directory an app.yaml file I found in the "GoogleAppEngine" directory in the directory "new_project_template", but Windows won't recognize the file (even after Yaml has been separately downloaded, as above).

SUMMARY: It is not clear how the file contents of this video ended up where they did, in the right format, and how they were created originally. Any help on this would be much appreciated! GAE looks like a far easier way to get into web development than mastering LAMP, but it seems that there is a hump at the beginning that assumes some prior web development knowledge. However, once over that hump, it looks like straightforward iteration in order to increase skill - which I look forward to.

Please could the initial creation of GAE apps be made a bit more explicit?

Thank you,

Hamish


Great video, hope to see more!

I guess it is very simple to build with google apps.


Video published, thanks for contributing to ShowMeDo


Your video has been edited. This is an automatic post by ShowMeDo.


Your video has been edited. This is an automatic post by ShowMeDo.


Your video has been edited. This is an automatic post by ShowMeDo.


Showmedo is a peer-produced video-tutorials and screencasts site for free and open-source software (FOSS)- with the exception of some club videos, the large majority are free to watch and download.

how to help » about » faq »

Educating the Open-source Community With Showmedo

Although as important as the software it supports, education and documentation are relatively neglected in the Open-source world. Coders love to code, and explaining how best to use or improve the software tends to be deferred or even sidelined.

At Showmedo we believe the community can play a vital role here and also say thanks for the tools and software that make our lives easier. If you have a piece of software you love or a programming langugage you are enthusiastic about, why not make a screencast showing others how to use it? All the stuff you wish you'd been told, the tips, tricks, insights that would have saved you time and frustration.

Screencasting is easier than you think, and we're happy to help you. You can emailus for advice or just use some of the how-to screencasts on the site. This screencasting learning-pathis a good place to start.

Kudos and Thanks for Kyran

Content

Feedback

Showmedo's development is fairly rapid and bugs will inevitably creep in. If you have any problems please drop us a line using the contact address below. Likewise, any suggestions for improvements to the site are gratefully received.

feedback@showmedo.com