9

I'm just starting with google app engine and I followed the basic hello world example on google app engine.

https://developers.google.com/appengine/docs/python/gettingstartedpython27/helloworld

created both files in the helloworld folder.

I don't want to use the GUI I prefer to use the mac terminal to work with this application. I want to start this application on my local host localhost:80 through the terminal.

to run my basic helloworld application locally all I say is

$ dev_appserver.py helloworld . but I get this error.

Traceback (most recent call last):
  File "/usr/local/bin/dev_appserver.py", line 184, in <module>
    _run_file(__file__, globals())
  File "/usr/local/bin/dev_appserver.py", line 180, in _run_file
    execfile(script_path, globals_)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 727, in <module>
    main()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 720, in main
    dev_server.start(options)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/devappserver2.py", line 554, in start
    options.yaml_files)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 556, in __init__
    module_configuration = ModuleConfiguration(yaml_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 82, in __init__
    self._yaml_path)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/tools/devappserver2/application_configuration.py", line 271, in _parse_configuration
    with open(configuration_path) as f:
IOError: [Errno 2] No such file or directory: 'helloworld'

I have two files in the helloworld directory. app.yaml

application: your-app-id
version: 1
runtime: python27
api_version: 1
threadsafe: true

handlers:
- url: /.*
  script: helloworld.application

and the helloworld.py

import webapp2

class MainPage(webapp2.RequestHandler):

    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.write('Hello, World!')


application = webapp2.WSGIApplication([
    ('/', MainPage),
], debug=True)
muhammed
  • 163
  • 1
  • 1
  • 6
  • The error says no file or directory. Does helloworld directory exist in the directory you ran the command from and does it have an app.yaml in it? – Tim Hoffman Sep 01 '13 at 02:39
  • Indeed I updated my post with the two files in it. I made sure to cd into the directory before running dev_appserver.py but still no good. – muhammed Sep 01 '13 at 02:49
  • 4
    If you cd into `helloworld` directory then the command should be `dev_appserver.py .` The argument is a path to the directory that contains app.yaml. If you are in that directory then the path is the full path to the current dir or `.` – Tim Hoffman Sep 01 '13 at 04:07

5 Answers5

5

After installing the google cloud sdk, did you run

gcloud components install app-engine-go

The documentation is kind of ridiculous in terms of organization. I totally missed this when I first started

Jim Chertkov
  • 1,199
  • 12
  • 20
3

I had the same problem. After some effort the command that worked for me, inside the google_appengine directory and not in the helloword dir is:

python dev_appserver.py helloworld/

maybe this helps.

0
  1. When you first launch Google App Engine, a prompt asks if you want to make "Command Symlinks" -- be sure to click OK, then enter the administrator password. That is what enables you to use symbolic links in the /usr/local/bin folder for the command dev_appserver.py.

  2. Enter the following into the terminal (command-line)

    $: /usr/local/bin/dev_appserver.py helloworld
    

Here's an example what my browser, terminal, and finder windows look like.

For reference, here is an O'Reilly guide to installing/running google app engine on mac.

  1. To shut down the web server, make sure the terminal window is active, then press Control-C
rayryeng
  • 102,964
  • 22
  • 184
  • 193
Kat Russo
  • 469
  • 4
  • 8
0

From the directory ...\Google\Cloud SDK\google-cloud-sdk\bin :

Instead of :

dev_appserver.py YOUR_DIRECTORY

Try :

py dev_appserver.py YOUR_DIRECTORY

Or :

python dev_appserver.py YOUR_DIRECTORY
G F
  • 321
  • 1
  • 5
  • 12
0

Create a directory test-dir

Extract google-cloud-sdk in this directory

Inside test-dir directory create another directory 'helloworld'

After creating both files from https://webapp2.readthedocs.io/en/latest/tutorials/gettingstarted/helloworld.html#tutorials-gettingstarted-helloworld in helloworld directory

In terminal:

Go to test-dir directory

Run: google-cloud-sdk/bin/dev_appserver.py helloworld/

crazysj
  • 405
  • 3
  • 8