Hybrid cloud deployment (IaaS/PaaS and FaaS) of Django web applications.
Project description
Django Cloud Deployer
This package facilitates hybrid cloud deployment (IaaS/PaaS and FaaS) of Django web applications. By annotating project urls with the plugin's wrapper functions, a developer can indicate in which cloud deployment model each url resource should be executed.
Requirements
To use this package, you will need the following Software tools:
You will also need the CLI tools of the cloud providers you will be using:
Setup
First, install the package:
pip install django-cloud-deployer
Then, make sure to add the package (and its requirements) to your project's requirements file:
pip freeze > requirements.txt
Usage
The package features two functions, runInPaaS
and runInFaaS
, that may be used to indicate in which cloud deployment model (PaaS or FaaS, respectively) a url resource should be executed.
Example:
# urls.py
from django.urls import include, path
from django_cloud_deployer import runInPaaS, runInFaaS
from . import views
urlpatterns = [
path('', views.home, name='home'),
runInPaaS(path('faq/', views.faq, name='faq')),
runInPaaS(path('polls/', include('polls.urls'))),
runInFaaS(path('auth/', include('auth.urls'))),
]
Note that, by default, url resources with run in FaaS.
CLI tool
The package may be used as a CLI tool:
$ python -m django_cloud_deployer
Usage: django_cloud_deployer <operation>
Available operations:
- deploy
- check_deploy
- destroy
Check Deploy
The check_deploy
command allows the developer to observe, based on the annotated urls, where each resource will be deployed and executed.
Usage:
$ python -m django_cloud_deployer check_deploy
Example:
$ python -m django_cloud_deployer check_deploy
Please enter the name of the Django settings module (e.g., 'mysite.settings'):
> mysite.settings
The following urls will run in the FaaS provider:
^/?$
^auth/login/?$
^auth/logout/?$
The following urls will run in the PaaS provider:
^polls/?$
^polls/(?P<pk>[0-9]+)/?$
^polls/(?P<pk>[0-9]+)/results/?$
^polls/(?P<question_id>[0-9]+)/vote/?$
Deploy
The deploy
command allows the developer to deploy the django project, based on the annotated urls.
Usage:
$ python -m django_cloud_deployer deploy <paas provider> <faas provider>
Available PaaS providers:
- heroku
Available FaaS providers:
- azure
Note that you will need to be logged in to the chosen PaaS and FaaS providers CLIs. If you are not, you will be asked to login first.
After the deployment is completed, a django_cloud_deployer.json
configuration file will be produced:
{
"projectName": "...",
"paasConfig": {
"provider": "...",
"resource": "...",
"url": "..."
},
"faasConfig": {
"provider": "...",
"resource": "...",
"url": "..."
}
}
Destroy
The destroy
command allows the developer to delete all the infrastructure resources created with the deployment of the Django project.
Usage:
$ python -m django_cloud_deployer destroy
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django_cloud_deployer-1.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b3747d57ef943f2002d56d05cec52b6b4b917cbd7fe50e41cb39351a9e94295 |
|
MD5 | 23029dae599e78fe90852659e73d60a0 |
|
BLAKE2b-256 | bd6c04cf1da8c938b53ad8d488af0278d0e2a7915223ff769946c359dfdc95e3 |
Hashes for django_cloud_deployer-1.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34d2a9399eedcc72547e252939bb98c34e1e7612ca095003fc546c3911cc8902 |
|
MD5 | 8e772b3eeee33281ce0c775db0af36fa |
|
BLAKE2b-256 | 511c818d6f8e3371dea4a88bca2801f21e06138f1f5e95f832f54549b6bf358f |