1

I'm using chalice for an application with a lot of endpoints. I don't want to separate it in several lambdas, because they share the same code (which is in chalicelib), but I want to separate somehow my app.py (e.g. I want it to be like app_user.py, app_sessions.py etc.) I'm not very good about Python core, but I think it should be possible to do it somehow using __init__.py to say the Chalice to glue my files together on the deployment.

tl;dr Is it possible to have something like #include from C in Python?

Thanks.

Ximik
  • 2,435
  • 3
  • 27
  • 53
  • I'm pretty sure you can't do this in Chalice, but there is an issue [#21](https://github.com/aws/chalice/issues/21) in their GitHub repo that has requested this feature. – dmulter Jun 06 '18 at 22:52
  • I think you must have all endpoints declared in your `app.py`, but you can have your logic separated and make each endpoint function call a different internal package to process the request and respond. From the standpoint of organizing your code, it's not that bad; you only have to edit your `app.py` when you need to add, change or remove an endpoint. – Renato Byrro Jun 23 '18 at 21:22
  • @RenatoByrro Ye, that's exactly what I do now. Code seems to be rather clean. Thanks. – Ximik Jul 05 '18 at 20:43

0 Answers0