I have some GAE apps which I am thinking to separate into three modules: default
(www
), mobile
and api
but I am having some difficulties understanding Modules and how to organize the code.
According to the image found here this is how an app should look like.
This is the simplifed structure I came up with so far:
gae-app/
├── modules
│ ├── api
│ │ ├── app.yaml
│ │ └── src
│ │ └── main.py
│ ├── mobile
│ │ ├── app.yaml
│ │ └── src
│ │ └── index.html
│ └── www
│ ├── app.yaml
│ └── src
│ ├── main.py
│ └── templates
├── cron.yaml
├── index.yaml
└── queue.yaml
The
api
module provides bunch of API functions and works fine on its own.The
mobile
module is just a bunch of html+js which is working just fine with theapi
module via ajax.The
default
(www
) module will someday become just like themobile
module containing only html+js files and working withapi
module via ajax but for now most of the templates are generated server side via jinja2 which is causing some questions.
Questions:
Since both
api
anddefault
(www
) modules are working server side with Datastore for now, where do I keep my Datastore models in this image/structure? In addition to that they both share some libraries, where do I keep them? Do I create a new "lib" folder in app's root folder and store the common/shared files there and then symlink it to each module? I am looking for some best practices.What's the best way to make all this work with separate git repos? I would want each of my modules to have its own repository. How would that work with shared models/libs from Q1? GAE apps with Modules seem to allow only one
dispath.yaml
/cron.yaml
/index.yaml
/queue.yaml
/ etc per app (not per module) so which repo would have those files?
I realize that there isn't a single correct answer to the questions but I am looking for best practices. Note that I just started working with Modules earlier today so my understanding how they work might be completely wrong.