GitXplorerGitXplorer
p

docker-nginx-postgres-django-example

public
162 stars
71 forks
0 issues

Commits

List of commits on branch master.
Verified
5ff81e45da073b8a9bc7e785dbdee1496a4f5204

Merge pull request #16 from pawamoy/dependabot/pip/django-2.2.26

ppawamoy committed 3 years ago
Verified
84cedf2379c34e54710bd87af0e2a394f84813de

Bump django from 2.2.20 to 2.2.26

ddependabot[bot] committed 3 years ago
Verified
6a90d654944f34861e799a35e4a1d227e4b8626b

Merge pull request #15 from pawamoy/dependabot/pip/ipython-7.16.3

ppawamoy committed 3 years ago
Verified
aeac7b41114905bc37956c1e216a0ebc59d89943

Bump ipython from 7.4.0 to 7.16.3

ddependabot[bot] committed 3 years ago
Verified
d3d071b66aa43c5fcdea838b968cd4850bd97f84

Merge pull request #10 from pawamoy/dependabot/pip/django-2.2.20

ppawamoy committed 3 years ago
Verified
5d83ac428cc197dd35239ffa174f37e53eb6ff8d

Bump django from 2.2.18 to 2.2.20

ddependabot[bot] committed 3 years ago

README

The README file for this repository.

Example using Docker, Django, multiple Postgres databases, NginX, Gunicorn, pipenv, GitLab CI and tox

This is a Docker setup for a web application based on Django.

  • The Django application is served by Gunicorn (WSGI application).
  • We use NginX as reverse proxy and static files server. Static and media files are persistently stored in volumes.
  • Multiple Postgres databases can be used. Data are persistently stored in volumes.
  • Python dependencies are managed through pipenv, with Pipfile and Pipfile.lock.
  • Support for multiple environment settings (variable DJANGO_SETTINGS_MODULE is passed to the djangoapp service).
  • Tests are run using tox, pytest, and other tools such as safety, bandit, isort and prospector.
  • Continuous Integration is configured for GitLab with .gitlab-ci.yml. CI follows a Build-Test-Release flow. WARNING: this part is not fully functional yet.

Also a Makefile is available for convenience. You might need to use sudo make instead of just make because docker and docker-compose commands often needs admin privilege.

Requirements

You need to install Docker and Docker-Compose.

Build

docker-compose build or make build.

Migrate databases

docker-compose run --rm djangoapp hello/manage.py migrate or make migrate.

Collect static files

docker-compose run --rm djangoapp hello/manage.py collectstatic --no-input' or make collectstatic.

Run

docker-compose up or make run.

Tests

  • make checksafety
  • make checkstyle
  • make test
  • make coverage

Related blog post

Docker Compose with NginX, Django, Gunicorn and multiple Postgres databases

License

Software licensed under the ISC license.