This skeleton can be used to scaffold a Chalice application. Follow these steps to get started:
- Run
python configure.py
to replace all placeholders throughout all the files.
Chalice is a framework for writing serverless apps in python. It allows you to create and deploy applications that use AWS Lambda quickly. It provides:
- A command line tool for creating, deploying, and managing your app
- A decorator-based API for integrating with Amazon API Gateway, Amazon S3, Amazon SNS, Amazon SQS, and other AWS services.
- Automatic IAM policy generation
Learn more on the GitHub repository or Chalice documentation.
The settings file structure is inspired in Django Settings.
Below there's a list of settings available and their default values:
Default: False
A boolean that turns on/off debug mode.
Default: dev
Chalice has the concept of stages, which are entirely separate sets of AWS resources.
However, the stage name is not available for reference in the project code. An alternative solution is to define an environment variable with the same name as the stage.
CHALICE_STAGE
does not interfere in the actual Chalice stage, and vice-versa. It's your responsibility to keep both in sync.
Default: A dictionary of logging settings.
It's a data structure containing configuration information. See also Logging.
Default: None
A DSN tells a Sentry SDK where to send events so the events are associated with the correct project.
If an SDK is not initialized or if it is initialized with an empty DSN (default behavior), the SDK will not send any data over the network, such as captured exceptions.
By default, this skeleton uses Python's standard logging module.
from logging import getLogger
logger = getLogger(__name__)
logger.info("Loading module [%s].", __name__)
def demo():
logger.info("Processing function [%s.demo].", __name__)
return True
To configure logging, you use LOGGING
to define a dictionary of logging settings. These settings describe the loggers, handlers, filters, and formatters you want in your logging setup and the log levels and properties you want those components to have.
This skeleton configures logging as part of the project initialization. Therefore, you can be sure that loggers are always ready for use.
Sentry is a developer-first error tracking and performance monitoring platform that helps developers see what matters, solve quicker, and learn continuously about their applications.
This skeleton configures Sentry out of the box with Chalice and AWS Lambda integrations; you only have to set SENTRY_DSN
in the settings.py file.