Easy serverless deploy of python web applications
Simple deploy of python web-apps @YandexCloud
Forget about setting up your own infrastructure, vps, network, orchestrators, etc... go serverless
- Deployment examples
- Yandex Cloud authorization
- Support and contribution
- setup virtual env, create your app
- create account at Yandex Cloud
- install Yappa
$ pip install yappa -U $ pip freeze > requirements.txt
- use Yappa:
$ yappa setup $ yappa deploy
...that's it! Your application is deployed
when your code is updated just run
$ yappa deploy
Both WSGI and ASGI applications are supported (as well as raw functions). So Django, Flask, FastAPI... etc could be easily deployed.
Furthermore, not just regular json API could be deployed this way. Several types of applications could be launched with Yappa:
- raw serverless function
- raw serverless function + Postgres
- json API (Flask, FastAPI, Django rest framework)
- single page application
- SPA + multiple API versions
more examples will be added soon
please see examples:
- Django Rest Framework basic - basic DRF app. To explore serverless and Yappa features, like management commands
- Django Rest Framework + Postgres -
- DRF app with managed Postgres connectivity
django manage.py commands are supported. just run
$ yappa manage migrate
In order to support management commands, for Django projects second cloud function is being created every deploy. It's made only for handling management commands, and it's not public. Therefore, commands do not support user inputs: to every command '--no-input' flag is added.
As of Django 3.0 env variables are supported for createsuperuser command. So you should deploy your app with DJANGO_SUPERUSER_USERNAME, DJANGO_SUPERUSER_PASSWORD environment variables. Then run
$ yappa manage createsuperuser
The other way around would be to implement custom management command (see StackOverflow topic)
Yandex Cloud authorization
Command '$ yappa setup' prompts you for OAuth token. Then, Yappa creates service account "yappa-uploader-service" with roles editor and serverless.functions.admin for the specified folder. Key for this account is created and saved locally at .yc file.
Command '$ yappa deploy' supports two types of authorization
- service account key saved at .yc file (generated during '$ yappa setup')
- environment variables YC_OAUTH and YC_FOLDER
There are some limitations, however YandexCloud team is constantly releasing new features and services. Also, the team of this project will try to keep up. So stay tuned :)
Managed Postgres and YandexDB is supported inside Yandex Cloud. In case any other DB - it has to have public IP address
For details on how te set up connection with managed postgres please refer to
Headers and authorization
Please note that some request headers (like Authorization) are deleted before function is invoked
Development and Contribution
In the near future we will be focused on documentation improvements (mainly deployment examples) and support of async tasks (serverless workers and scheduler for celery).
- installing grpcio on Apple M1: installing with anaconda may help. Also look at stackoverflow
- versions of python 3.7 support yappa up to 0.3.12. You should use python 3.8 and above for new versions of yappa.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.