GithubHelp home page GithubHelp logo

jensenzhu / django-docker Goto Github PK

View Code? Open in Web Editor NEW

This project forked from trialbox/django-docker

0.0 2.0 0.0 26 KB

常见 web 项目的 django 模板, 并使用 docker 部署生产环境

Python 79.29% Shell 7.40% HTML 4.51% JavaScript 8.80%

django-docker's Introduction

Django-Docker

Development Environment

One-command setup with Docker

docker installation doc

download the lastest code, go into the src path and run

$ docker-compose build

3 images are expected:

  • Python 2.7 / Django 1.8
  • Redis 3.0.7
  • MySQL 5.7

Environment without Docker

Required:

  • Python 2.7
  • Redis 3.0.7

download the lastest code, go into the src path and run

pip install -r requirements.txt

Backend Database Migration

use either MySQL or SQLite3

MySQL

Env-with-Docker uses MySQL by default

$ docker-compose run backend /bin/bash
$ python manage.py migrate
$ python manage.py createsuperuser  --username=admin [email protected]
# interactive input and output
# Password: (123)
# Password (again): (123)
# Superuser created successfully.

SQLite3

Env-without-Docker uses MySQL by default

run script in src path

./install.sh

run dev server

  • without docker:

    ./run.sh

  • docker:

    docker-compose up

  • go into docker

    • go into docker: docker-compose run backend /bin/bash
    • run server: ./run.sh

Testing

  1. Backend basic testing

    • operation: visit 127.0.0.1:8000 in browser
    • expection: home page is opened
  2. Redis Connection

    • operation: visit 127.0.0.1:8000 in browser, and refresh it
    • expection: I have been seen xxx times. is shown and xxx increase by refreshing
  3. MySQL Connection

    • operation: visit 127.0.0.1:8000/admin in browser, login in by username / password
    • expection: logined and admin page is opened.

Production Environment

Built-in Tools

run crawler:

$ python manage.py runscript crawler

django-docker's People

Contributors

jackonyang avatar

Watchers

 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.