Dockerized Django (Production ready in 1 click)

Photo by Jakob Owens on Unsplash

Dockerized Django (Production ready in 1 click)

ยท

2 min read

Hi reader,

Presenting to you a turnkey solution that allows you to effortlessly launch your Django server with a single script. Whether you're in the early stages of development or preparing to go live in a production environment, my Dockerized Django application has you covered. Just unzip the repository, execute ./run.sh for development, or ./run-prod.sh for production on your server. With this boilerplate, you'll be hosting your Django application with HTTPS support and Django 4.2 LTS.

You can buy it here: https://raturinitin.gumroad.com/l/django-dockerized-starter-boilerplate

Features:

  • Django-Starter-Boilerplate: A production-ready, SSL-enabled, and containerized Django boilerplate that streamlines your deployment process.

Dependencies:

  • Docker: The industry-standard containerization platform.

  • Docker Compose: A tool for defining and running multi-container Docker applications.

Getting Started with Docker:

  1. Unzip the repository.

  2. Create a .env file by copying .env.sample with the command: cp .env.sample .env.

  3. Establish the necessary directories, namely templates and static, at the base level where manage.py resides.

  4. Launch the containers using ./run.sh.

  5. To stop the containers, use ./stop.sh.

For Production:

  • Create a .env.prod file and populate it by copying and replacing values from .env.sample.

  • Configure your DNS 'A' records to point to the value specified in the VIRTUAL_HOST variable within the .env.prod file.

  • Execute ./run-prod.sh to initiate the production-ready containers.

Note: In a development environment, ./stop.sh also removes the associated volumes, so use this command with caution.

Running Without Docker:

  1. Unzip the repository.

  2. Create a .env file using .env.sample As a template: cp .env.sample .env.

  3. Inside the .env file set DEBUG to True and SQL_ENGINE to django.db.backends.sqlite3.

  4. Create the required directories, templates, and static, at the base level where manage.py is located.

  5. Initiate your Django server with the command: python manage.py runserver.

That's it! With this production-ready Dockerized Django application, you can expedite your Django project deployment, confident in its performance, security, and ease of use. Say goodbye to the complexities of setup and hello to efficient Django application hosting.

If you get stuck while deploying or running this boilerplate, reach out to me at Twitter @raturinitin

You can buy it here: https://raturinitin.gumroad.com/l/django-dockerized-starter-boilerplate

Did you find this article valuable?

Support Nitin Raturi by becoming a sponsor. Any amount is appreciated!

ย