Update README.md
Some checks are pending
CodeQL / Analyze (python) (push) Waiting to run
Build Debian package / build (push) Waiting to run
Build Docker image / buildx (push) Waiting to run
Deploy static content to Pages / deploy (push) Waiting to run
Build Homebrew package / build (push) Waiting to run
Build GitHub Pages website / build (push) Waiting to run
Build GitHub Pages website / deploy (push) Blocked by required conditions
Run linters / lint (push) Waiting to run
Build Pip package / build (push) Waiting to run
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Waiting to run
Run tests / docker_tests (push) Waiting to run

This commit is contained in:
Nick Sweeting 2024-12-17 22:53:05 -05:00 committed by GitHub
parent 2b77422d5b
commit b4c5004c86
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1371,11 +1371,17 @@ git pull --recurse-submodules
```bash ```bash
# Install ArchiveBox + python dependencies # Install ArchiveBox + python dependencies
pip install uv pip install uv
uv venv ./bin/lock_pkgs.sh # (aka `uv venv; uv sync;` + generate requirements.txt)
uv sync
archivebox init # Install ArchiveBox runtime dependencies
archivebox setup mkdir -p data && cd data
archivebox install # on >=v0.8.5 (otherwise `archivebox setup`)
# Run the development server w/ autoreloading (but no bg workers)
archivebox manage runserver --debug --reload 0.0.0.0:8000
# Run the production server (with bg workers but no autoreloading)
archivebox server 0.0.0.0:8000
``` ```
#### 2. Option B: Build the docker container and use that for development instead #### 2. Option B: Build the docker container and use that for development instead
@ -1384,14 +1390,15 @@ archivebox setup
# Optional: develop via docker by mounting the code dir into the container # Optional: develop via docker by mounting the code dir into the container
# if you edit e.g. ./archivebox/core/models.py on the docker host, runserver # if you edit e.g. ./archivebox/core/models.py on the docker host, runserver
# inside the container will reload and pick up your changes # inside the container will reload and pick up your changes
docker build . -t archivebox ./bin/build_docker.sh dev
docker run -it \
-v $PWD/data:/data \ docker run -it -v $PWD/data:/data archivebox/archivebox:dev init --setup
archivebox init --setup
docker run -it -p 8000:8000 \ # Run the development server w/ autoreloading (but no bg workers)
-v $PWD/data:/data \ docker run -it -v $PWD/data:/data -v $PWD/archivebox:/app/archivebox -p 8000:8000 archivebox/archivebox:dev manage runserver 0.0.0.0:8000 --debug --reload
-v $PWD/archivebox:/app/archivebox \
archivebox server 0.0.0.0:8000 --debug --reload # Run the production server (with bg workers but no autoreloading)
docker run -it -v $PWD/data:/data -v $PWD/archivebox:/app/archivebox -p 8000:8000 archivebox/archivebox:dev server
# (remove the --reload flag and add the --nothreading flag when profiling with the django debug toolbar) # (remove the --reload flag and add the --nothreading flag when profiling with the django debug toolbar)
# When using --reload, make sure any files you create can be read by the user in the Docker container, eg with 'chmod a+rX'. # When using --reload, make sure any files you create can be read by the user in the Docker container, eg with 'chmod a+rX'.
@ -1409,11 +1416,15 @@ You can also run all these in Docker. For more examples see the GitHub Actions C
<details><summary><i>Click to expand...</i></summary> <details><summary><i>Click to expand...</i></summary>
```bash ```bash
# set up persistent DEBUG=True for all runs
archivebox config --set DEBUG=True archivebox config --set DEBUG=True
# OR you can run a dev server with DEBUG=True in a few ways:
archivebox manage runserver --debug --reload 0.0.0.0:8000
# or # or
archivebox server --debug ... archivebox server --debug 0.0.0.0:8000
# faster dev version wo/ bg workers enabled: # or
daphne -b 0.0.0.0 -p 8000 archivebox.core.asgi:application env DEBUG=True daphne -b 0.0.0.0 -p 8000 archivebox.core.asgi:application
``` ```
https://stackoverflow.com/questions/1074212/how-can-i-see-the-raw-sql-queries-django-is-running https://stackoverflow.com/questions/1074212/how-can-i-see-the-raw-sql-queries-django-is-running