Giter Club home page Giter Club logo

subhomoy-roy-choudhury / boilerplate-docker-django-gunicorn-nginx Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mgnisia/boilerplate-docker-django-gunicorn-nginx

0.0 0.0 0.0 33 KB

This repo contains a small example for a Django App in a Docker Container. For the deployment the docker-compose file uses Gunicorn and nginx. Based on the repo of Pawamoy (https://github.com/Pawamoy/docker-nginx-postgres-django-example).

License: MIT License

Dockerfile 100.00%

boilerplate-docker-django-gunicorn-nginx's Introduction

Boilerplate-Docker-Django-Gunicorn-Nginx

This repo contains a small example for a Django App in a Docker Container. For the deployment the docker container uses Gunicorn and nginx.

The Dockerfile and the docker-compose-File are based on the repo from pawamoy. The config file includes a setup for an additional database, however this is not included in the docker-compose-File. If you would like to checkout the configuration for this setup have a look in the pawamoy-repo.

Manual

To build this container run in the folder of the docker-compose-file:

  1. docker-compose build
  2. docker-compose run -d this runs the containers detachted
  3. Open you favourite browser and go to localhost/index/
  4. To shutdown run docker-compsose down

Installing new libraries

Just run pipenv install your_library and the pipenv will update the pipfile and check for the dependencies. Make sure you have pipenv installed in your own (not the virtualenv one) python3 installation.

Static Files

Dockerfile

The static files are mounted wih the volumes of the docker-compose files! However if you change the static files make sure, you remove the volumes with docker volumes prune or run docker-compsose down -v. Those commands remove the volumes and if you run docker-compose build again the volumes will be mounted again correctly ๐Ÿ˜„ You can inspect all listed mounted files in the menu

Templates

To include the static files in your templates you can insert in e.g. in your header:

<link rel="stylesheet" href="{% static 'demo/css/main.css' %} ">

You can also select another path, just make sure that the static files will be collect when the command python3 manage.py collectstatic will be run. In the current setting the static files are set via STATICFILES_DIRS = [os.path.join(BASE_DIR, 'demo', 'static'),].

boilerplate-docker-django-gunicorn-nginx's People

Contributors

dependabot[bot] avatar mgnisia 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.