Service to get up-to-date information about countries and cities.
Install the appropriate software:
- Docker Desktop.
- Git.
- PyCharm (optional).
cp .env.sample .env
docker compose up --build
docker exec -it countries-informer-app bash
python manage.py migrate --fake sessions zero
python manage.py showmigrations sessions [ ] 0001_initial
python manage.py migrate --fake-initial
Clone the repository to your computer:
git clone https://github.com/miamib34ch/HSE-Python-CountriesInformer.git
-
To configure the application copy
.env.sample
into.env
file:cp .env.sample .env
This file contains environment variables that will share their values across the application. The sample file (
.env.sample
) contains a set of variables with default values. So it can be configured depending on the environment. -
Build the container using Docker Compose:
docker compose build
This command should be run from the root directory where
Dockerfile
is located. You also need to build the docker container again in case if you have updatedrequirements.txt
. -
Now it is possible to run the project inside the Docker container:
docker compose up
When containers are up server starts at http://0.0.0.0:8020. You can open it in your browser.
- To manage your api you need to add superuser.
Connect to the application Docker-container (if you are outside the container):
Create superuser:
docker compose exec app bash
./manage.py createsuperuser
- Go to http://0.0.0.0:8020/admin and manage your database.
The project contains a special Makefile
that provides shortcuts for a set of commands:
-
Build the Docker container:
make build
-
Generate Sphinx documentation run:
make docs-html
-
Autoformat source code:
make format
-
Static analysis (linters):
make lint
-
Autotests:
make test
-
Run autoformat, linters and tests in one command:
make all
Run these commands from the source directory where Makefile
is located.
The project integrated with the Sphinx documentation engine. It allows the creation of documentation from source code. So the source code should contain docstrings in reStructuredText format.
To create HTML documentation run this command from the source directory where Makefile
is located:
make docs-html
After generation documentation can be opened from a file docs/build/html/index.html
.
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.