A management command that auto-configures for deployment.
Project description
django-simple-deploy
Initial Django deployments made easy
This app gives you a management command that configures your project for an initial deployment. It targets Heroku and Azure at the moment, and can be expanded to target other platforms as well.
If you have a relatively simple Django project that runs locally, you can deploy your project in a few short steps. The only change you'll need to make to your project is to add this app to INSTALLED_APPS
.
By default, the above command will deploy your project to Heroku. You can use the --platform
argument to deploy to Azure instead:
$ python manage.py simple_deploy --automate-all --platform azure
All output is captured and written to a log file stored in simple_deploy_logs/
, which is placed at the project's root directory.
Table of Contents
- Prerequisites
- Quick start: using
--automate-all
on Heroku or Azure - If it doesn't work
- Understanding costs
- Contributing
- Good luck, and please be mindful
- More about Heroku deployments
- More about Azure deployments
- Additional documentation
Prerequisites
Cloud platform account
If you haven't already done so, make an account on the platform you want to use, and install the appropriate CLI:
- For Heroku deployments, install the Heroku CLI.
- For Azure deployments, install the Azure CLI.
Use Git
Also, make sure you're using Git to track your project. You should commit all changes to your project before running simple_deploy, so you can easily revert the changes that simple_deploy makes if you need to.
Identify dependencies
Make sure your project is running in a virtual environment, and you have either:
- Built a
requirements.txt
file with the commandpip freeze > requirements.txt
; - Or, used Poetry to manage your project's requirements using a
pyproject.toml
file; - Or, used Pipenv to create a
Pipfile
.
Quick start: using --automate-all
on Heroku or Azure
The --automate-all
flag allows you to deploy your project in just three steps:
- Install
django-simple-deploy
:- With pip:
$ pip install django-simple-deploy
- With Poetry:
$ poetry add django-simple-deploy
- With Pipenv:
$ pipenv install django-simple-deploy
- With pip:
- Add
simple_deploy
toINSTALLED_APPS
. - Run
simple_deploy
:- For a Heroku deployment:
python manage.py simple_deploy --automate-all
- For an Azure deployment:
python manage.py simple_deploy --automate-all --platform azure
- For a Heroku deployment:
This will take care of creating a new app, configuring your project for deployment, committing all changes, pushing the project to your platform's servers, running the initial migration, and opening the project in a new browser tab.
The default Heroku deployment should be free unless you already have more than the minimum allowed apps. The default Azure deployment uses a Postgres database that costs $0.034/hour ($24.82/month, as of 12/1/21).
Azure deployments can only be done with the --automate-all
flag. If you don't automate everything, there's so much to do manually that it's not worth using simple_deploy
.
Read more about Heroku deployments, more about Azure deployments, or see the full set of CLI arguments.
If it doesn't work
If anything doesn't work, this project will try to tell you what to do in order to deploy successfully. If it doesn't work and you think it should, feel free to open an issue. If the deployment fails and you want to undo all of these changes, you should be able to check out your last commit before starting this process and pick up your deployment efforts from there. You can also uninstall this package with the command pip uninstall django-simple-deploy
. If you do this, make sure to remove simple_deploy
from INSTALLED_APPS
.
If you've lost the terminal output after running manage.py simple_deploy
, you can find the output in the simple_deploy_logs/
directory. If you need to disable logging, you can use the --no-logging
flag:
$ python manage.py simple_deploy --no-logging
Understanding costs
Every cloud provider charges something for a deployment that's expected to be available at all times, and that's a perfectly reasonable policy. Platforms should provide a free or low-cost option for people who are learning to make deployments. Each platform differs in how they approach offering this kind of support.
The django-simple-deploy project tries to use the lowest-cost option on each platform that's supported, but ultimately the cost of any deployment is entirely your responsibility. Whatever platform you choose, make sure you understand how to access the provider's dashboard, and be diligent about knowing your current and ongoing costs.
This project will make some references to specific plans and their costs, but those plans and costs can change at any time. Again, it is your responsiblity to verify anything you read here, and make sure you're not incurring more charges than you anticipated.
If you see anything here that is inaccurate, please open an issue.
Contributing
If you want to contribute to this project, feel free to open an issue and share how you'd like to help.
A great way to get started is to clone the project and run the integration tests. See the current testing documentation to get started.
This project has adopted the Contributor Covenant as a Code of Conduct.
Good luck, and please be mindful
Web apps have been around for a while now, and many people take them for granted because we've seen so many silly projects. But the power of a web app has never been diminished; if you have an idea for a project and you know how to build an app, you can share your idea with the world and see if it goes anywhere.
Every project that gains traction has an impact on people's lives. Many have unintended consequences, and some of that can not be avoided. If your project is gaining traction, please be mindful of the positive and negative impact it can have on people, and do what's needed to make sure it's a net positive in the world. :)
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-simple-deploy-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5b7bfc1194c22f6609e7194141972f606186bcb9df103f2841bdbd743aaefdc4 |
|
MD5 | a5ea07657c60816a13a21e8a97dab82b |
|
BLAKE2b-256 | de7f27b276d80ec8bee32d7094cb569caaaffff7c3d413dd5573ef129a2ab352 |
Hashes for django_simple_deploy-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf97126b1de13e9ec18a8d9c6ae3f32975baae88d9f42b6ea78ee69f69b4d61d |
|
MD5 | bf4b4facfcdfebe3cbba8e9066384ace |
|
BLAKE2b-256 | da96d37671d0cbad80242c08bce64290f6f54ea254396fbb448d6fd9a7b8faea |