Abhilash Muthuraj
Abhilash Muthuraj

Reputation: 2028

google app engine path in linux?

I'm starting to learn googleapp engine and use python. Whenever i create a new project, should i always include whole bunch of configuration and python files like these,

abhilash@abhilash:~/python_resources/google_appengine$ ls
appcfg.py  bulkload_client.py  demos             google  LICENSE               README         remote_api_shell.py  tools
BUGS       bulkloader.py       dev_appserver.py  lib     new_project_template  RELEASE_NOTES  templates            VERSION

Can i put the dev_appserver.py and others to /bin/bash, so i could use them whenever i create a project? Or how to setup appengine permanently in my workplace?

Upvotes: 5

Views: 7649

Answers (4)

Digvijay Chougale
Digvijay Chougale

Reputation: 105

Add following lines to .bashrc file

export PATH=$PATH:/path/to/google_appengine/
export PYTHONPATH="$PYTHONPATH:/path/to/google_appengine:/path/to/google_appengine/‌​lib/:/path/to/google_appengine/lib/yaml/"

Upvotes: 0

JP Ventura
JP Ventura

Reputation: 5732

If you are using Google Cloud SDK, add this to your ~/.profile (or ~/.bash_profile in OS X):

#!/usr/bin/env bash

export CLOUDSDK_ROOT_DIR="/path/to/google/cloud/sdk/"
export APPENGINE_HOME="${CLOUDSDK_ROOT_DIR}/platform/appengine-java-sdk"
export GAE_SDK_ROOT="${CLOUDSDK_ROOT_DIR}/platform/google_appengine"

# The next line enables Java libraries for Google Cloud SDK
export CLASSPATH="${APPENGINE_HOME}/lib":${CLASSPATH}

# The next line enables Python libraries for Google Cloud SDK
export PYTHONPATH=${GAE_SDK_ROOT}:${PYTHONPATH}

# * OPTIONAL STEP *
# If you wish to import all Python modules, you may iterate in the directory
# tree and import each module.
#
# * WARNING *
# Some modules have two or more versions available (Ex. django), so the loop
# will import always its latest version.
for module in ${GAE_SDK_ROOT}/lib/*; do
  if [ -r ${module} ]; then
    PYTHONPATH=${module}:${PYTHONPATH}
  fi
done
unset module

Upvotes: 1

Jimmy Kane
Jimmy Kane

Reputation: 16825

Also it might be useful to add app engine to your python path as well.

Like so for me that I prefer to keep app engine in /usr/local/

export GAE="/usr/local/google_appengine"
export PYTHONPATH="$PYTHONPATH:$GAE"
export PATH="$PATH:$GAE"

This might come in handy if for example you want to use some of the libraries to run tests on an external module source and so on...

Upvotes: 3

mechanical_meat
mechanical_meat

Reputation: 169304

A new GAE project doesn't need any of those files.
Per the Getting Started Guide, all you need is app.yaml and main.py.

If your goal is less command-line typing you can add the google_appengine dir to your PATH in your .bashrc, e.g.

export PATH=$HOME/google_appengine:$PATH

You'll also want to create a symlink to python2.5, like so:

ln -s /usr/bin/python2.5 ~/google_appengine/python

Then you can just do this to run your app on the development server:

$ dev_appserver.py /path/to/myapp/

Upvotes: 12

Related Questions