Our development process is focused on high quality and development comfort. We use tools that are proven to be the best in class.
There are two possible ways to develop your apps.
You can choose one or use both at the same time. How to choose what method should you use?
Local development is much easier and much faster. You can choose it if you don’t have too many infrastructure dependencies. That’s a default option for the new projects.
docker development means that you already have a complex
setup of different technologies, containers, networks, etc.
This is a default option for older and more complicated projects.
poetry to manage dependencies.
So, please do not use
Before going any further, please,
take a moment to read the official documentation
poetry to know some basics.
If you are using
docker then prepend
docker-compose run --rm web
before any of those commands to execute them.
Please, note that you don’t need almost all of them with
You can just skip this sub-section completely.
Go right to Development with docker.
You do not need to run any of these command for
docker based development,
since it is already executed inside
Please, note that
poetry will automatically create a
this project. It will use you current
To install all existing dependencies run:
To install dependencies for production use, you will need to run:
poetry install --no-dev
And to activate
virtualenv created by
Adding new dependencies¶
To add a new dependency you can run:
poetry add djangoto install
djangoas a production dependency
poetry add --dev pytestto install
pytestas a development dependency
This command might be used with
Updating poetry version¶
Package managers should also be pinned very strictly. We had a lot of problems in production because we were not pinning package manager versions.
This can result in broken
lock files, inconsistent installation process,
bizarre bugs, and missing packages. You do not want to experience that!
How can we have the same
poetry version for all users in a project?
[build-system] tag shines. It specifies the exact version of
poetry installation that must be used for the project.
Version mismatch will fail your build.
When you want to update
poetry, you have to bump it in several places:
Then you are fine!
Development with docker¶
To start development server inside
docker you will need to run:
docker-compose build docker-compose run --rm web python manage.py migrate docker-compose up
Running scripts inside docker¶
As we have already mentioned inside the previous section
docker-compose run to run scripts inside docker.
What do you need to know about it?
You can run anything you want:
Most likely it will have a permanent effect, due to
You need to use
--rmto automatically remove this container afterward
docker commands do not need to use
virtualenv at all.
You might want to tweak
to include your
docker container address into it.
django-debug-toolbar might not show up.
To get your
docker ip run:
docker inspect your-container-name | grep -e '"Gateway"'
You can also configure a permanent hostname inside your
docker containers with a permanent hostname.
When cloning a project for the first time you may need to configure it properly, see Django section for more information.
Note, that you will need to activate
poetry before running any of these commands.
Note, that you only need to run these commands once per project.
When using local development environment without
you will need a
postgres up and running.
To create new development database run
(make sure that database and user names are correct for your case):
psql postgres -U postgres -f sql/create_database.sql
Then migrate your database:
python manage.py migrate
If you have reached this point, you should be able to run the project.
python manage.py runserver