docker-compose up --build
docker-compose up -d --build
docker-compose logs -f web
docker-compose down
docker build -t hello-django .
docker run -p 8000:8000 hello-django
docker run -p 8000:8000 -v $(pwd):/app hello-django
docker-compose exec web python manage.py migrate
docker-compose exec web python manage.py createsuperuser
docker-compose exec web python manage.py shell
sudo apt update sudo apt install python3-pip python3-venv
python3 -m venv venv
source venv/bin/activate
pip install pytest-django
pytest --version python -c "import pytest_django; print(pytest_django.version)"
echo "pytest-django" >> requirements.txt pip install -r requirements.txt
- Create pytest.ini in your project root
[pytest]
DJANGO_SETTINGS_MODULE = myproject.settings
python_files = tests.py test_*.py *_tests.py
- In VS Code, go to settings and set "Python Testing: pytest Enabled" to true.
- Run tests using the Testing sidebar in VS Code or via command line with
pytest.
https://code.visualstudio.com/docs/python/testing
source .venv/bin/activate && python -m pytest tests/test_e2e_simple.py -v