Um template para quem quiser usar o Docker + PGSQL + Django.

Overview

Django + PGSQL + Docker Template

Tecnologias usadas:

- Django
- Django Rest Framework
- Docker
- Postgres

Como usar o template

  1. Se você for usar algum tipo de biblioteca adicional no projeto django, lembre-se de adicionar ao arquivo requirements.txt antes de proseguir.

  2. Mude o arquivo .env.example para .env e preencha com os dados solicitados.

# DJANGO

# DEBUG = 1 or 0
DEBUG=
SECRET_KEY=

# DJANGO_ALLOWED_HOSTS = localhost 127.0.0.1 [::1] ...
DJANGO_ALLOWED_HOSTS=

# POSTGRES
POSTGRES_DB=
POSTGRES_USER=
POSTGRES_PASSWORD=

# PGADMIN
PGADMIN_DEFAULT_EMAIL=
PGADMIN_DEFAULT_PASSWORD=
  1. Se quiser usar o template drf quando for iniciar a aplicação Django sinta-se a vontade. Lembre-se de checar todas as configrações tanto em settings.py quanto em outros arquivos.

  2. Com tudo preparado rode no terminal o comando:

$ docker-compose run web django-admin startproject nome_do_app .

Ele ira iniciar a build do Docker e ira criar o app django principal.

DevContainer VSCODE

Se você usa o VsCode com a extensão devcontainers você pode abrir o projeto e começar a desenvolver. Basta apenas que você inicie e selecione a Workspace web.

Usando o Docker

Caso você não use o VsCode você terá que usar o docker para fazer a migração, iniciar o server e etc.

Com isso basta apenas que você sempre o rode o comando do docker mais a operação desejada.

Exemplo:

$ docker-compose run web python manage.py migrate

ou

$ docker-compose run web python manage.py runserver

Usando o PGADMIN

Se por acaso você for usar o PGADMIN para fazer a manipulação de dados do postgres. Aqui vai umas instruções.

  1. Crie o usuário root com o comando:
$ docker-compose exec web python manage.py createsuperuser
  1. Abra o PGADMIN em localhost:5050 em algum navegador.

  2. Faça login com as informações passadas no arquivo .env

PGADMIN_DEFAULT_EMAIL=
PGADMIN_DEFAULT_PASSWORD=
  1. Crie uma conexão com o postgres usando o host db

Criando a conexão com o db.

  1. O nome que terá que ser passado é docker_django_postgres_db. ( Lembre-se que esse nome pode ser alterado no arquivo compose )

Conectando no DB

  1. Insira as informações solicitadas, ambas podem ser consultadas no arquivo .env que você tem. ( Ou se preferir no settings.py)

Detalhes da conexão

  1. E pronto, agora é só conferir as informações usando a barra lateral do PGADMIN.

DB data

Consultas/Links

Documentação do Docker com Django

Criando um projeto Django com Docker

khezen/compose-postgres Github

SeanVowles/docker-django-postgres Github

Owner
Drack
Apenas outro humano usando o GitHub
Drack
Cookiecutter Flask OpenAPI is a template for jumpstarting production-ready Flask projects quickly.

Cookiecutter Flask OpenAPI is a template for jumpstarting production-ready Flask projects quickly. It has a well organized and scalable structure. It uses API design first

Roger Camargo 3 Nov 17, 2022
A boilerplate Django project for quickly getting started.

The Definitive Django Learning Platform. Django Project Boilerplate This repository is a boilerplate Django project for quickly getting started. Getti

Le Huynh Long 1 Nov 01, 2021
A framework for launching new Django Rest Framework projects quickly.

DRFx A framework for launching new Django Rest Framework projects quickly. Comes with a custom user model, login/logout/signup, social authentication

William Vincent 400 Dec 29, 2022
This is a boilerplate for a basic backend app using Python, Django and SQLite, as developed after tutorials with Programming with Mosh

This is a boilerplate for a basic backend app using Python, Django and SQLite, as developed after tutorials with Programming with Mosh

Gustavo Catala Sverdrup 1 Jan 07, 2022
PyPC is a very simple tool that creates Python projects from templates.

PyPC (Python Project Creator) PyPC is a very simple tool that creates Python projects from templates. In 0.1v#alpha, custom template creation will be

art3m1s 1 Nov 26, 2021
Django project/application starter for lazybones :)

Django Project Starter Template My custom project starter for Django! I’ll try to support every upcoming Django releases as much as I can! Requirement

Uğur Özyılmazel 40 Jul 16, 2022
Mad-cookiecutter - Cookiecutter templates for MaD projects

MaD Cookiecutter Templates A set of templates that can be used to quickly get st

Machine Learning and Data Analytics Lab FAU 1 Jan 10, 2022
A template repository implementing HTML5 Boilerplate 8.0 in Sanic using the Domonic framework.

sanic-domonic-h5bp A template repository implementing HTML5 Boilerplate 8.0 in Sanic using the Domonic framework. If you need frontend interactivity,

PyXY 3 Dec 12, 2022
A Boilerplate repo for Scientific Python Open Science projects

A Boilerplate repo for Scientific Python Open Science projects Installation Clone this repo If you need a fresh python environment, run $ conda env cr

Vincent Choqueuse 2 Dec 23, 2021
Django sample app with users including social auth via Django-AllAuth

demo-allauth-bootstrap Simple, out-of-the-box Django all-auth demo app A "brochure" or visitor (no login required) area A members-only (login required

Andrew E 215 Dec 20, 2022
Generic python project template

generic-python-project-template generic-python-project-template STEPS - STEP 01- Create a repository by using template repository STEP 02- Clone the n

SUNNY BHAVEEN CHANDRA 3 Oct 03, 2022
Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Template repository to build PyTorch projects from source on any version of PyTorch/CUDA/cuDNN.

Joonhyung Lee/이준형 651 Dec 12, 2022
Forkable, Minimal Template for Starknet Projects.

Forkable, Minimal Template for Starknet Projects.

andreas 44 Oct 09, 2022
Basic Docker Compose template application with Flask, Celery, Redis, MySQL, SocketIO, Nginx and Gunicorn.

Nginx / Gunicorn / Flask 🐍 / Celery / SocketIO / MySQL / Redis / Docker 🐳 sample application Basic Docker Compose template application for orchestat

Alex Oarga 8 Aug 06, 2022
Project template layout for Django 3.0+

Django 3.0+ project template This is a simple Django 3.0+ project template with my preferred setup. Most Django project templates make way too many as

José Padilla 649 Dec 30, 2022
A Django starter template with a sound foundation.

SOS Django Template SOS Django Tempalate is a Django starter template that has opinionated and good solutions while starting your new Django project.

Eray Erdin 19 Oct 30, 2022
A boilerplate for Django web applications

Django Hackathon Starter A boilerplate application for Django web applications. If you've attented hackathons, you already know how much time can be w

David Leonard 1.6k Dec 31, 2022
A cookiecutter template for python scripts

cookiecutter-py-script A cookiecutter template for python scripts Prerequisites Git Usage pip install cookiecutter

Zeheng Li 1 Dec 14, 2022
Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly.

Cookiecutter Django Powered by Cookiecutter, Cookiecutter Django is a framework for jumpstarting production-ready Django projects quickly. Documentati

Daniel Roy Greenfeld 10k Jan 01, 2023
A simple cookiecutter to create Python Telegram bots, wrapped with Django.

PTB Django cookiecutter A simple cookiecutter to create Python Telegram bots, wrapped with Django. Based on this cool projects python-telegram-bot (PT

Carlos Lugones 20 Nov 12, 2022