Docker/Heroku Integration of Django Dance School
Note: If you are setting up a Docker or Heroku project for the first time,
it is recommended that you find someone with a background in the use of these
systems to ensure that your deployment goes as smoothly as possible. If you
encounter errors or missing functionality in setting up this template, please
submit an issue to the issue tracker, or email django.danceschool@gmail.com <mailto:django.danceschool@gmail.com>
_.
The Django Dance School <http://django-danceschool.org/>
project is designed
to be exceptionally flexible and modular, and it can be run locally as well as
on any server system that supports Django. However, you probably want to get
your school operational as quickly as possible. That's why we've created this
template. By using this template, you can quickly set up your school to work
with Heroku <https://www.heroku.com/>
and Amazon S3 <https://aws.amazon.com/s3/>
_ to handle everything and begin operating as
quickly as possible.
A key feature of this template is that it is designed to load most credentials and settings from environment variables, rather than directly from your settings.
Using this template and following the manual method installation instructions below also makes it easy for you to begin adding custom templates, custom plugins, and any other custom functionality that goes beyond the basic functions of the project.
For more details, see the Django Dance School documentation <https://django-danceschool.readthedocs.io/en/latest/installation_production.html>
_.
Docker Deployment ^^^^^^^^^^^^^^^^^
You Will Need:
Windows 10 WSL <https://docs.microsoft.com/en-us/windows/wsl/install-win10>
_)Note These steps assume that you are using the included LetsEncrypt capabilities for SSL. If you are planning to provide your own SSL certificate, or you need to use OpenSSL because you are testing on a server that is not associated with any domain name, you will be prompted for that when you run the Bash script.
Clone this repository:
::
git clone https://github.com/django-danceschool/production-template.git
Edit the file env.web
to insert value for the following environment variables:
ALLOWED_HOST
: Your site's domain name (e.g. mydanceschool.com)VIRTUAL_HOST
: Your site's domain nameLETSENCRYPT_HOST
: Your site's domain nameLETSENCRYPT_EMAIL
: Your email address at which you want to receive error
notices related to LetsEncrypt.Run the included Docker setup-stack.sh
Bash script. You will be prompted
to provide a range of pieces of information that are needed for setup. And,
as part of the script, you will also be prompted to take the usual steps needed
for a Django deployment of the project (running initial migrations, collecting
static files, creating a superuser, and running the setupschool
command to
initialize the database).
::
cd production-template docker/setup_stack.sh
Use the docker
command to deploy your stack!
::
docker stack deploy -c docker-compose.yml school
Button-Based Heroku deployment ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. image:: https://www.herokucdn.com/deploy/button.svg :target: https://heroku.com/deploy
python3 manage.py createsuperuser
python3 manage.py setupschool
exit
to close the command line process, close out of the console,
navigate to https://Manual Heroku Deployment (recommended for customization) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
You will need:
here <https://git-scm.com/>
_).here <https://devcenter.heroku.com/articles/heroku-cli>
_).Open a command line in the location where you would like the local copy of your installation to live. Clone this repository to your local folder:
git clone https://github.com/django-danceschool/production-template.git
Login to Heroku:
heroku login
Create a new Heroku app:
heroku create <your-app-name>
Push your project to Heroku, where it will now be deployed (this will take a few minutes the first time that you do it):
git push heroku master
Use one-off dynos to run the initial database migrations that your project needs and to create a superuser (you will be prompted for a username and password):
::
heroku run python3 manage.py migrate heroku run python3 manage.py createsuperuser
Optional, but strongly recommended: Run the easy-installer setup script, and follow all prompts. This script will guide you through the process of setting initial values for many things, creating a few initial pages that many school use, and setting up user groups and permissions that will make it easier for you to get started running your dance school right away.
::
heroku run python3 manage.py setupschool
Go to your site and log in!