Overview¶
System requirements¶
gitwith a version at least2.16or higherdockerwith a version at least18.02or higherdocker-composewith a version at least1.21or higherpythonwith exact version, seepyproject.toml
Architecture¶
config¶
config/.env.template- a basic example of what keys must be contained in your.envfile, 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 thedockerimage.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 adockerimage.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 specifiesdockerservices that are needed for development and testingdocker-compose.override.yml- local override fordocker-compose. Is applied automatically and implicitly when no arguments provided todocker-composecommandmanage.py- main file for yourdjangoproject. Used as an entry point for thedjangoprojectpyproject.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-djangourls definitionserver/wsgi.py-djangowsgi definitionserver/asgi.py-djangoasgi definitionserver/apps/- place to put all your apps intoserver/apps/main-djangoapplication, used as an example, could be removedserver/settings- settings defined withdjango-split-settings, see this tutorial for more informationserver/templates- external folder fordjangotemplates, used for simple files asrobots.txtand so on
docker¶
docker/docker-compose.prod.yml- additional service definition file used for productiondocker/django/Dockerfile-djangocontainer definition, used both for development and productiondocker/django/entrypoint.sh- entry point script that is used whendjangocontainer is startingdocker/django/gunicorn_config.py- that’s how we configuregunicornrunnerdocker/django/gunicorn.sh- production script fordjangousinggunicorndocker/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-pytestplugins that are used in this projecttests/test_server- tests that ensures that basicdjangostuff is working, should not be removedtests/test_apps/test_main- example tests for thedjangoapp, could be removedtests/conftest.py- main configuration file forpytestrunner
docs¶
docs/Makefile- command file that builds the documentation for Unixdocs/make.bat- command file for Windowsdocs/conf.py-sphinxconfiguration 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:
postgresrabbitmqfrontend, 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.