Coder Social home page Coder Social logo

awsompankaj / confetti Goto Github PK

View Code? Open in Web Editor NEW

This project forked from funnydman/confetti

0.0 1.0 0.0 372 KB

The way to start a Django project with Docker and docker-compose

License: BSD 3-Clause "New" or "Revised" License

Shell 5.21% Python 80.99% Dockerfile 6.10% CSS 0.71% HTML 6.99%

confetti's Introduction

CONFETTI

The way to start a Django project with Docker

Technology Stack

  • Docker v20.x
  • Docker-compose v1.28
  • Django v3.x

Getting Started

Development

  1. Clone this git repository to your local machine.

  2. Install docker and docker-compose using official documentation.

  3. Add user to the docker group to run commands without sudo:

sudo usermod -aG docker $USER
  1. Update settings in dev.env and confetti/settings/prod.py(recommended).

  2. Go to the project root and run:

docker-compose up
  1. Create Django superuser in the container(in the second shell):
docker-compose exec web python manage.py createsuperuser 
  1. Run tests(optional):
docker-compose exec web python manage.py test 
  1. Navigate to http://localhost:8000/.

Production

  1. Create and fill .env and confetti/settings/prod.py.

  2. Run application:

docker-compose -f docker-compose.prod.yml up
  1. Generate certificates(see next section).

  2. Navigate to https://localhost/.

Tips

How to generate ssl certificates? Follow this guide.

The simplest way with less headaches:

  1. ssh to the server and go to the project root, assume that you configured domains properly:
docker-compose -f docker-compose.prod.yml exec nginx sh
  1. Install certbot:
apk update && apk add certbot certbot-nginx
  1. Generate certificates, we use volumes so we don't need to copy certs manually, don't forget to commit them or even better exclude them from git tracking:
certbot certonly --nginx # follow instructions
  1. Update data in deployment/nginx/app.conf, and then:
docker-compose -f docker-compose.prod.yml up --build

Ad Hoc docker/docker-compose commands (put in .bash_aliases):

alias dcubn=docker-compose build --no-cache
alias dcub=docker-compose up --build
alias dcu=docker-compose up

โญ๏ธ Thanks everyone who has starred the project, it means a lot!

Happy coding ๐Ÿ˜Š

confetti's People

Contributors

funnydman avatar awsompankaj avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.