GithubHelp home page GithubHelp logo

franfran / django-docker-mysql Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 15 KB

A django project template with docker for quick start local development

License: MIT License

Python 83.99% Shell 16.01%

django-docker-mysql's Introduction

django + mysql local development using docker

The objectives:

  • start a local dev environment of django
  • docker volumes are mounted to local folders so all changes take effect immediately
  • MySQL port are binded locally for easier development
  • commit code with migration, requirements
  • teammate pull the respository
  • and they have the exact same environment

Getting Started

Install docker

https://docs.docker.com/engine/getstarted/step_one/#step-1-get-docker

Pull this res and setup env

$ cd django-docker-mysql
$ virtualenv -p /usr/bin/python2.7 venv
$ source venv/bin/activate
$ pip install -r django/requirements.txt

Start the docker

$ docker-compose -f docker/dev/docker-compose.yml up

Django

Browse your site in http://127.0.0.1:8000/

Start development code in django/ folder

MySQL

Connect to the MySQL through 127.0.0.1:3307
username: root
password: password

The data are stored in docker/dev/volumes/db

Stack

  • Python 2.7
  • Django 1.8.17
  • MySQL 5.7

Commands

Re-build the docker images

$ docker-compose -f docker/dev/docker-compose.yml build --no-cache

Connect to the running django container

First, list and find out the container name

$ docker ps -a

Then connect to it

$ docker exec -it <container_name> bash

e.g.

$ docker exec -it django_dev_1 bash

Running the container as daemon

docker-compose -f docker/dev/docker-compose.yml up -d

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.