The next step was to establish and configure my project. Before we get into that, I wanted a couple of Go packages to make things easier, namely github.com/astaxie/beego and github.com/beego/bee. I compiled the second package into the "bee" command.
I already had a directory in my root called "goprojects2". I created a "src" subdirectory. Then I went into the SDK command prompt and issued:
set gopath=%gopath%;c:\goprojects2
then went to the goprpjects2 directory and entered
bee new beegaenames
The "bee" command created a scaffold for my project. However, I had to convert the project from Beego to Beegae. I went into main.go (in goprojects2/src/beegaenames), and replaced "beego" with "beegae" . I also went into controllers/default.go and routers/router.go, replacing "beego" with "beegae".
I needed to do one last thing before writing Go, namely create index.yaml on the same level as main.go. This file indexed my database. Here are the contents:
indexes:
- kind: Name
ancestor: no
properties:
- name: FirstName
direction: asc
- name: LastName
direction: asc
In the next installment, we'll get into the actual code.
Friday, August 29, 2014
Tuesday, August 26, 2014
Example of Beegae (Beego for App Engine) - Part 1
Sorry I've been gone for so long! I recently created a simple web form using Beegae. The setup was rather involved, but worth it. I will assume you have Git and Python 2.x already installed. I needed to install Go (http://golang.org/) and Google Cloud SDK (https://cloud.google.com/developers/ ; click "Download the SDK" for instructions). I used Datastore, the original NoSQL native to App Engine.
The next thing I had to do was install the Go SDK. To to that, I went into the Google Cloud SDK console window, and issued
gcloud components update gae-go
If you're using the Windows version, there might be a bug in goapp.bat. You will probably find it at
C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine
I issued the following to retrieve the Beegae Go package:
goapp get github.com/astaxie/beegae
and got this error...
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
I fixed the problem by these steps:
The next thing I had to do was install the Go SDK. To to that, I went into the Google Cloud SDK console window, and issued
gcloud components update gae-go
If you're using the Windows version, there might be a bug in goapp.bat. You will probably find it at
C:\Program Files\Google\Cloud SDK\google-cloud-sdk\platform\google_appengine
I issued the following to retrieve the Beegae Go package:
goapp get github.com/astaxie/beegae
and got this error...
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
I fixed the problem by these steps:
- Open Notepad as Administrator
- Open goapp.bat
- Put the %GOROOT%\bin\%EXENAME% line, along with all the parameters, on a new line
- Put quotation marks (") around %GOROOT%\bin\%EXENAME%
- Save (make sure NOT as a .TXT file) and Exit
If you're a bit squeamish, Copy goapp.bat as goapp.bat.old first. I reissued the above "goapp" command, and this time it ran. In the next installment, I'll get into how I configured this project.
Subscribe to:
Posts (Atom)