Skip to content

Commit 4806ba7

Browse files
committed
remove standalone manage container
- scrap the standalone manage container - run console commands against app container - update docs
1 parent 74a0f82 commit 4806ba7

File tree

3 files changed

+10
-23
lines changed

3 files changed

+10
-23
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ jobs:
1818
run: docker-compose up -d web
1919

2020
- name: Run test suite
21-
run: docker-compose exec -T app sh -c "cd /opt/codebuddies && pytest -v"
21+
run: docker-compose run -T --rm app pytest -v
22+
if: always()
2223

2324
- name: Check Migrations are up-to-date
24-
run: docker-compose run --rm manage makemigrations --check
25+
run: docker-compose run -T --rm app ./manage.py makemigrations --check
2526
if: always()

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ To stop the application and remove all containers, run the following.
5959
docker-compose down
6060
```
6161

62-
5. Create a superuser so that you can log into http://localhost:8000/admin by running the following in your terminal: `$ docker-compose run --rm manage createsuperuser`
62+
5. Create a superuser so that you can log into http://localhost:8000/admin by running the following in your terminal: `$ docker-compose run --rm app ./manage.py createsuperuser`
6363

6464
## Editing Code
6565

@@ -89,21 +89,21 @@ If you would like to tail the logs in the console then you remove the detach fla
8989

9090
The following are examples of some common Django management commands that you may need to run.
9191

92-
* Make Migrations: `docker-compose run --rm manage makemigrations`
93-
* Merge Migrations: `docker-compose run --rm manage makemigrations --merge`
94-
* Run Migrations: `docker-compose run --rm manage`
92+
* Make Migrations: `docker-compose run --rm app ./manage.py makemigrations`
93+
* Merge Migrations: `docker-compose run --rm app ./manage.py makemigrations --merge`
94+
* Run Migrations: `docker-compose run --rm app ./manage.py`
9595

9696
To see the full list of management commands use `help`.
9797

9898
```plain
99-
docker-compose run --rm manage help
99+
docker-compose run --rm app ./manage.py help
100100
```
101101

102102
### Automated Tests
103103

104104
* We use [pytest](https://docs.pytest.org/en/latest/contents.html) with the [pytest-django](https://pytest-django.readthedocs.io/en/latest/) plugin for running tests.
105105
* Please add tests for your code when contributing.
106-
* Run the test suite using `docker-compose exec app sh -c "cd /opt/codebuddies && pytest"`
106+
* Run the test suite using `docker-compose run --rm app pytest`
107107

108108
### Import Postman collection
109109
Postman is a free interactive tool for verifying the APIs of your project. You can download it at postman.com/downloads.

docker-compose.yaml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ services:
3333
sh -c "python /opt/codebuddies/manage.py collectstatic --clear --no-input &&
3434
python /opt/codebuddies/manage.py migrate &&
3535
uwsgi --ini /opt/codebuddies/uwsgi.ini"
36+
working_dir: /opt/codebuddies
3637
volumes:
3738
- ./project:/opt/codebuddies
3839
environment:
@@ -76,18 +77,3 @@ services:
7677
restart: on-failure
7778
ports:
7879
- 8025:8025
79-
80-
# Manager allows you to run Django management tasks on the application.
81-
manage:
82-
container_name: manage
83-
restart: on-failure
84-
build: ./project
85-
command: shell
86-
entrypoint: /usr/local/bin/python3 /opt/codebuddies/manage.py
87-
volumes:
88-
- ./project:/opt/codebuddies
89-
environment:
90-
- DATABASE_URL=postgres://babyyoda:mysecretpassword@db:5432/codebuddies
91-
- EMAIL_HOST=mailhog
92-
depends_on:
93-
- db

0 commit comments

Comments
 (0)