from google.appengine.ext import ndb class TestModel(ndb.Model): x = ndb.StringProperty(required=True) y = ndb.GeoPtProperty z = ndb.DateTimeProperty(auto_now_add=True) TestModel(x="test").put() TestModel.query(TestModel.x == "test")
mvn archetype:generate com.google.appengine.archetypes:skeleton-archetype 1 com.jaccarmac.neumont-dlc example 0-1-0 Y
example/example-ear/src/main/application/META-INF/appengine-application.xml
.
<application>example</application>
example/pom.xml
.
<appengine.target.version>1.9.6</appengine.target.version>
mvn clean install
lein new compojure example
lein ring uberwar
example/appengine-web.xml
.
<appengine-web-app xlmns="http://appengine.google.com/ns/1.0"> <application>example</application> <version>0-1-0</version> <threadsafe>true</threadsafe> </appengine-web-app>
example/war/WEB-INF
.
dev_appserver.sh war appcfg.sh update war
// Use Go as a Javascript VM for App Engine. package notnode import ( "fmt" "github.com/robertkrimen/otto" "io/ioutil" "net/http" ) func init() { http.HandleFunc("/", handleRequestFromJs("/")) http.HandleFunc("/easter", handleRequestFromJs("/easter")) } func handleRequestFromJs(path string) func(http.ResponseWriter, *http.Request){ return func(w http.ResponseWriter, r *http.Request) { vm := otto.New() vm.Set("requestPath", path) vm.Set("printToWeb", func(call otto.FunctionCall) otto.Value { fmt.Fprint(w, call.Argument(0).String()) return otto.Value{} }) program, err := ioutil.ReadFile("main.js") if err != nil { panic(err) } vm.Run(string(program)) } }
if (requestPath === "/easter") { printToWeb("You found my secret!"); } else { printToWeb("Hello, otto world!"); }
Get from this:
import webapp2 class MainPage(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' self.response.write('Hello, world!') app = webapp2.WSGIApplication([('/', MainPage)], debug=True)
To this:
import flask app = flask.Flask(__name__) @app.route('/') def helloworld(): return('Hello, world!')
Or, for Lisp lovers:
(import flask) (setv app (flask.Flask __name__)) (with-decorator (app.route "/") (defn hy-world [] "Hy, world!"))
What you want to do:
virtualenv venv -p python2.7
source venv/bin/activate
pip install Flask
dev_appserver.py .
What you have to do:
(import sys) (import os.path) (sys.path.append (os.path.join (os.path.dirname __file__) "venv/lib/python2.7/site-packages"))
hy2py main.hy > main.py
Now get out there and hack some stuff.