Skip to content

Latest commit

 

History

History
116 lines (81 loc) · 2.87 KB

INSTALL.md

File metadata and controls

116 lines (81 loc) · 2.87 KB

Installing project for developing on local PC

You have to have the following tools installed prior initializing the project:

Backend

Task runner

For easier running of everyday tasks, like:

  • run dev server
  • run all tests
  • run linters
  • run celery workers
  • ...

We use invoke.

It provides shortcuts for most of the tasks, so it's like collection of bash scrips or makefile or npm scripts.

Python interpreter

Also invoke abstract "python interpreter", so you can use both virtual env and dockerized python interpreter for working with project (see .invoke file).

  • virtualenv is the default approach that requires python interpreter, virtualenv, etc.
  • dockerized is simpler for quick starting project and for experienced developers

Suggested approach is using virtualenv

Services

Project may use external services like Database (postgres), message broker, cache (redis). For easier set up they are defined in docker-compose.yml file, and they are automatically prepared / started when using invoke.

Prepare python env using virtualenv

  1. Set up aliases for docker hosts in /etc/hosts:
127.0.0.1 postgres
127.0.0.1 redis
  1. Create separate python virtual environment if you are going to run it in local:
pyenv install 3.9.5
pyenv virtualenv 3.9.5 test_project-backend
pyenv local test_project-backend
pyenv activate test_project-backend
  1. Set up packages for using invoke
pip install -r requirements/local_build.txt
  1. Start project initialization that will set up docker containers, python/system env:
inv project.init
  1. Run the project and go to localhost:8000 page in browser to check whether it was started:
$ inv django.run

That's it. After these steps, the project will be successfully set up.

Once you run project.init initially you can start web server with inv django.run command without executing project.init call.

PyCharm console

Open Pycharm settings->Build,Execution,Deployment->Console->Django Console then copy below into Starting script

from django_extensions.management.shells import import_objects
from django.core.management.color import no_style

globals().update(
    import_objects({"dont_load": [], "quiet_load": False}, no_style())
)

Devops tools

You will need:

Most of needed shortcuts can be called via invoke inv k8s.###. Just make sure that you log in with inv k8s.login

k8s.logs
k8s.python-shell