0

My main.py file is getting really big!

I'm aware you can move the Request handlers out to their own files in a package.

I've seen you need to add some init.py file to the handlers folder to declare this, and I expect you need to then import your handlers to main.py.

My questions is: what is the correct process for doing this? Any good documentation would be great.

TimothyAURA
  • 1,329
  • 5
  • 21
  • 44

1 Answers1

0

You can do it at the python module (i.e. .py file) level as well, not necessarily at a package level, a bit simpler (no need for __init__.py files). Up to you.

For python module level split you can find some examples here:

Community
  • 1
  • 1
Dan Cornilescu
  • 39,470
  • 12
  • 57
  • 97
  • So I can move each RequestHandler to its own requesthandler.py file? And then use app.yaml to call the appropriate file? – TimothyAURA Mar 03 '17 at 03:50
  • If you want to use `app.yaml` you need to do a bit more in those files, see the quote in this answer: http://stackoverflow.com/questions/42547973/deploy-python-script-on-google-cloud-platform/42548535#42548535 – Dan Cornilescu Mar 03 '17 at 03:58
  • I prefer splitting inside `main.py` - seems simpler to me. – Dan Cornilescu Mar 03 '17 at 03:59