-
Notifications
You must be signed in to change notification settings - Fork 8
Organize
GeorgeNava edited this page Jul 16, 2011
·
8 revisions
Your application will grow in no time, so it is better to be prepared from the beginning and organize it in folders according to their content:
/myapp
- /app <-- app.go
- /db <-- db.go
- /html <-- your html templates
- /media <-- your static content like images, video and audio
- /models <-- your entities and methods for data access
- /prg <-- all your go programs, views, handlers, utils, etc.
- /web <-- your static css and js files
- app.yaml
- favicon.ico
- robots.txt
This way is easier to tell app.Config where everything is so it can find the resources when it needs them. Static folders like media and web can be declared "static" in app.yaml so everything stored in them will be automatically served and cached by appengine.
A standard app.yaml config file looks like this:
application: myappid
version: 1
runtime: go
api_version: 1
handlers:
- url: /favicon.ico
static_files: favicon.ico
upload: favicon.ico
- url: /robots.txt
static_files: robots.txt
upload: robots.txt
- url: /media
static_dir: media
- url: /web
static_dir: web
- url: /admin/.*
script: _go_app
login: admin
- url: /.*
script: _go_app
Everything else is handled by app.go with simplicity. Give it a try!