Giter Club home page Giter Club logo

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

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

confetti's Issues

docker-entrypoint.sh doesn't seem to be executed

I initially noticed collectstatic and migrate didn't run automatically when rolling out a new instance.

Adding a test statement doesn't seem to result in the expected behavior.

#!/usr/bin/env sh
set -x
echo "Test" > /app/test
...

.env format?

Can you please include the information that should be included in the .env file? I'm assuming something related to the username and password but im unsure of the format.

License?

Hi could you add a license to this project please? Otherwise it’s not really usable by anyone else as they won’t have the rights to the code.

You also might want to take a look at the Django license as you are redistributing their code. Not entirely sure how that works legally speaking.

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.