Code Monkey home page Code Monkey logo

django-docker's Introduction

django-docker

A complete example for deploying Django project with Nginx and MySQL on Docker.

QuickStart

Install Docker Engine from the tutorial https://docs.docker.com/engine/installation/.
Install Docker Compose from the tutorial https://docs.docker.com/compose/install/.
Get the latest project clone to your computer:

$ git clone https://github.com/huchenw/django-docker.git

Run docker-compose commands to start containers:

$ docker-compose up -d

Now you can access the application at http://localhost or http://192.168.99.100(Docker Toolbox).

Static Files

To collect static files for nginx to access, just run:

$ docker-compose exec web bash
$ python manage.py collectstatic

Django Admin

If you want to access django admin site, please apply the django default migrations to database:

$ docker-compose exec web bash
$ python manage.py migrate

Then you need to create a superuser account:

$ python manage.py createsuperuser
$ ...

Celery Results

Redis is used as broker for Celery http://docs.celeryproject.org/en/latest/getting-started/brokers/redis.html.
The official tutorial http://docs.celeryproject.org/en/latest/django/ tells us how to use Celery with Django.
You can check the Celery results from logs:

$ docker-compose logs celery

Docker Images Reference

Name Image
Nginx https://hub.docker.com/_/nginx/
MySQL https://hub.docker.com/_/mysql/
Redis https://hub.docker.com/_/redis/
Python https://hub.docker.com/_/python/

django-docker's People

Contributors

huchenw 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

Watchers

 avatar  avatar  avatar  avatar  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.