Multiple Webapp2 Instances or Modules

55 views
Skip to first unread message

victor noagbodji

unread,
May 20, 2016, 5:07:23 PM5/20/16
to Google App Engine
The documentation now defines modules as the way to structure a big project made of small parts. We have something similar structured the following way:

app.yaml
- url: /profile/*
  script
: profile.app
- url: /account/*
  script
: account.app
- url: /css
  mime_type: text/
css
  static_dir
: css
...

account
.py (has its own Webapp2 app instance)
profile
.py (has its own webapp2 app instance)
...

css
/
js
/

Each part (account, profile, etc...) has its own webapp2 instance. I would like to get some comments/feedback on how I structured the project so far. There may be drawbacks that I haven't considered.

Also, we are going to split the project in two. The two "sub-projects" need the same database layer. They will also reuse parts I assigned different webapp2 instances to. The only difference is that they will have their own endpoints and own static assets. The end goal is to have two separate custom domains.

I don't know if I went the wrong path and should be using modules instead with the current code. Has anyone done anything similar or run into similar issue? Would like to know if we should switch to modules.

Adam (Cloud Platform Support)

unread,
May 23, 2016, 7:03:32 PM5/23/16
to Google App Engine
It would depend if 'profile' and 'account' had any other kind of shared local state between them. If they do not, it would make sense to factor them out into separate modules for better scalability. You would need to do this anyway if your end goal is to have them served from separate subdomains (at least using the module routing facilities of App Engine).

Often the best way to know what drawbacks will occur is to try it and see what breaks.

victor noagbodji

unread,
May 24, 2016, 6:05:42 AM5/24/16
to Google App Engine
Thanks for your input Adam.
Reply all
Reply to author
Forward
0 new messages