Overview¶
System requirements¶
git
with a version at least2.16
or higherdocker
with a version at least18.02
or higherdocker-compose
with a version at least1.21
or higherpython
with exact version, seepyproject.toml
Architecture¶
config¶
config/.env.template
- a basic example of what keys must be contained in your.env
file, this file is committed to VCS and must not contain private or secret valuesconfig/.env
- main file for secret configuration, contains private and secret values, should not be committed to VCS
root project¶
README.md
- main readme file, it specifies the entry point to the project’s documentation.dockerignore
- specifies what files should not be copied to thedocker
image.editorconfig
- file with format specification. You need to install the required plugin for your IDE in order to enable it.gitignore
- file that specifies what should we commit into the repository and we should not.gitlab-ci.yml
- GitLab CI configuration file. It basically defines what to do with your project after pushing it to the repository. Currently it is used for testing and releasing adocker
image.python-version
- file that specifies the Python version to be used for the project, particularly when using pyenv. This file helps in maintaining a consistent Python environment across different machines and environmentsCHANGELOG.md
- file that contains a chronological log of all notable changes made to the project. It provides a comprehensive overview of the project’s evolution and helps users and contributors understand the development historydocker-compose.yml
- this the file specifiesdocker
services that are needed for development and testingdocker-compose.override.yml
- local override fordocker-compose
. Is applied automatically and implicitly when no arguments provided todocker-compose
commandmanage.py
- main file for yourdjango
project. Used as an entry point for thedjango
projectpyproject.toml
- main file of the project. It defines the project’s dependencies.poetry.lock
- lock file for dependencies. It is used to install exactly the same versions of dependencies on each buildsetup.cfg
- configuration file, that is used by all tools in this projectlocale/
- helper folder, that is used to store locale data, empty by defaultscripts/
- helper folder, that contains various development scripts and teardown for local development
server¶
server/__init__.py
- package definition, empty fileserver/urls.py
-django
urls definitionserver/wsgi.py
-django
wsgi definitionserver/asgi.py
-django
asgi definitionserver/apps/
- place to put all your apps intoserver/apps/main
-django
application, used as an example, could be removedserver/settings
- settings defined withdjango-split-settings
, see this tutorial for more informationserver/templates
- external folder fordjango
templates, used for simple files asrobots.txt
and so on
docker¶
docker/docker-compose.prod.yml
- additional service definition file used for productiondocker/django/Dockerfile
-django
container definition, used both for development and productiondocker/django/entrypoint.sh
- entry point script that is used whendjango
container is startingdocker/django/gunicorn_config.py
- that’s how we configuregunicorn
runnerdocker/django/gunicorn.sh
- production script fordjango
usinggunicorn
docker/django/ci.sh
- file that specifies all possible checks that we execute during our CI process for djangodocker/caddy/Caddyfile
- configuration file for Caddy webserverdocker/caddy/ci.sh
- file that specifies all possible checks that we execute during our CI process for caddy
tests¶
tests/plugins
-pytest
plugins that are used in this projecttests/test_server
- tests that ensures that basicdjango
stuff is working, should not be removedtests/test_apps/test_main
- example tests for thedjango
app, could be removedtests/conftest.py
- main configuration file forpytest
runner
docs¶
docs/Makefile
- command file that builds the documentation for Unixdocs/make.bat
- command file for Windowsdocs/conf.py
-sphinx
configuration filedocs/index.rst
- main documentation file, used as an entry pointdocs/pages/project
- folder that will contain documentation written by you!docs/pages/template
- folder that contains documentation that is common for each project built with this templatedocs/documents
- folder that should contain any documents you have: spreadsheets, images, requirements, presentations, etcdocs/README.md
- helper file for this directory, just tells what to do next
Container internals¶
We use the docker-compose
to link different containers together.
We also utilize different docker
networks to control access.
Some containers might have long starting times, for example:
postgres
rabbitmq
frontend, like
node.js
To be sure that container is started at the right time,
we utilize wait-for-it
script.
It is executed inside docker/django/entrypoint.sh
file.
We start containers with tini
.
Because this way we have a proper signal handling
and eliminate zombie processes.
Read the official docs to know more.