- Install Python 3.7 or 3.10, then
$ pip install virtualenv
$ sudo apt-get install libpq-dev
$ git clone https://https://gitlab.com/crvc1998/hexagonal-architecture-python.git
$ cd hexagonal-architecture-python
In the files, there is a .env.example file, copy into .env file and change the values of variables
# Copy the .env.example
$ cp .env.example .env
To use a local database:
# Run only the first time
$ mkdir docker/db
$ docker-compose -f docker/docker-compose.yml up -d
$ py -m venv venv
$ source venv/bin/activate
$ chmod +x ./setup.sh
$ ./setup.sh
$ docker-compose -f docker/docker-compose.yml exec web bash
$ python manage.py db create # already executed in docker-compose file
$ python manage.py db migrate
$ python manage.py server # run the server (run flask without docker-compose)
To run the tests:
$ docker-compose -f docker/docker-compose.yml exec web bash
$ python manage.py db create test
$ python manage.py db migrate test
$ python manage.py check tests