Giter VIP home page Giter VIP logo

django-nginx-gunicorn-docker's Introduction

django-nginx-gunicorn-docker

Django+nginx+gunicornでのデプロイを一瞬で実行するdocker-composeです。

(Use docker-compose to easily deploy with Django + nginx + gunicorn.)

How to use

・Clone repository

このリポジトリをクローンします。

(Clone this repository.)

$ git clone https://github.com/tken2039/django-nginx-gunicorn-docker.git

・Directory structure

次のようなディレクトリ構造が想定されています。

(Assume the following directory structure:)

django-nginx-gunicorn-docker/
      ├ nginx/
      │ └ project.conf
      ├ django/
      │  ├ Dockerfile
      │  ├ requirements.txt
      │  └ [DJANGOPROJECT]
      │     ├ manage.py
      │     ├ …
      │     └ [PROJECTNAME]
      └ docker-compose.yml

上記のディレクトリツリーの[DJANGOPROJECT]が、あなたのDjangoProjectになるよう配置してください。([PROJECTNAME]は、settings.pyなどが入っているディレクトリです。)

(Place [DJANGOPROJECT] to be your DjangoProject. ([PROJECTNAME] directory contains settings.py etc.))

・Setting

django/Dockerfileの一部を編集します。直接編集も可能ですが、LinuxOSの方は以下のコマンドを使うと楽ちんです。

(Edit part of django/Dockerfile. For LinuxOS, use the following command.)

$ sed -i -e s/MYPROJECT/[PROJECTNAME]/g Dockerfile

Dockerfileは、デフォルトではプロジェクト名がMYPROJECTになっているので、sedコマンドであなたのプロジェクト名([PROJECTNAME])に書き換えています。

(Since the default Dockerfile has a project name of MYPROJECT, it is rewritten to your project name ([PROJECTNAME]) using the sed command.)

・Execution

docker-compose.ymlが存在するディレクトリで以下のコマンドを実行します。

(In the directory where docker-compose.yml exists, execute the following command:)

$ docker-compose up

ブラウザでlocalhostを開いて、結果を確認してみましょう!ポート番号は不要です。

(Let's open localhost with a web browser. No port number is required.)

・Attention

  • Djangoプロジェクト内のsettings.pyで、localhostを許可しておきましょう。(ALLOWED_HOSTSのところ) (Edit "ALLOWED_HOSTS" in settings.py to allow 'localhost'.)
  • ファイアウォールの設定で80番ポートへのアクセスを許可しておきましょう。 (Edit the firewall to allow access to port 80.)

repletion

Djangoのプロジェクトを編集した場合は、次のコマンドで反映可能です。

(If you edit a Django project, you can reflect it with the following command:)

$ docker restart CONTAINERNAME

CONTAINERNAMEには、Djangoコンテナのコンテナ名を入れてください。

(In CONTAINERNAME, write container name of "Django Container".)

django-nginx-gunicorn-docker's People

Contributors

tken2039 avatar dependabot[bot] avatar

Watchers

James Cloos 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.