Skip to content

juls08/hello_django

Repository files navigation

Option 1: Using Docker Compose (Recommended)

Build and start all services (Django, PostgreSQL, Redis)

docker-compose up --build

Or run in detached mode

docker-compose up -d --build

View logs

docker-compose logs -f web

Stop services

docker-compose down

Option 2: Using Docker Only

Build the image

docker build -t hello-django .

Run the container

docker run -p 8000:8000 hello-django

Or run with volume mounting for development

docker run -p 8000:8000 -v $(pwd):/app hello-django

Additional Commands

Run migrations inside the container

docker-compose exec web python manage.py migrate

Create superuser

docker-compose exec web python manage.py createsuperuser

Access Django shell

docker-compose exec web python manage.py shell

Install pytest-django

1. Install pip if not already installed

sudo apt update sudo apt install python3-pip python3-venv

2. Create a virtual environment (recommended)

python3 -m venv venv

3. Activate the virtual environment

source venv/bin/activate

4. Install pytest-django

pip install pytest-django

Verify Installation

pytest --version python -c "import pytest_django; print(pytest_django.version)"

If you have a requirements.txt:

echo "pytest-django" >> requirements.txt pip install -r requirements.txt

Configure pytest in VS Code

  • 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.

Run tests in parallel

https://code.visualstudio.com/docs/python/testing

Run your Playwright tests with:

source .venv/bin/activate && python -m pytest tests/test_e2e_simple.py -v

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors