Estas instruções supoem que você esteja rodando a BookWyrm utilizando o Docker. Você vai precisar instalar o Docker e o docker-compose para começar.
If you are contributing to BookWyrm in a dockerless development environment we would love for you to help us update this guide to include instructions for setting up a dockerless development environment.
git clone pra baixar o código para seu computador.main branch, so ensure that is the branch you have checked out: git checkout main.env.example and .env.dev.example) into new files named .env and env.dev. Na linha de comando, você pode fazer assim:cp .env.example .env
cp .env.dev.example .env.dev
Most environment variables are set in the .env file, used in production, but for some development workflows that is overridden by the env.dev file. When developing for BookWyrm, you will need both files.
./bw-dev create_secrets # Create the secrets file with random values. You only need to do this once.
./bw-dev dev up --build # Build and start development stack
./bw-dev dev runweb python manage.py admin_code # Shows the admin-code for initial setup. You only need to do this once.
http://localhost:1333. If you have removed the PORT value in .env.dev this will be http://localhost. If you have changed the port, swap out 1333 for the port you are using.Se estiver curiosa: o comando ./bw-dev é um shell script simples que executa várias ferramentas: no exemplo acima, você poderia pular o script e executar docker-compose build ou docker-compose up diretamente, se preferir. ./bw-dev só junta esses comandos em um só, por conveniência. Run it without arguments to get a list of available commands, read the documentation page for it, or open it up and look around to see exactly what each command is doing!
Se você quiser editar ou criar um modelo, você provavelmente vai alterar a estrutura do banco de dados. Para que essas alterações funcionem, você precisará executar o comando makemigrations do Django para criar um novo arquivo de migrações do Django e então migrá-lo:
./bw-dev makemigrations
./bw-dev dev migrate
Toda vez que você alterar o CSS ou o JavaScript, você precisará rodar o comando collectstaticdo Django para que as alterações passem a funcionar:
./bw-dev dev collectstatic
Se você tiver o yarn instalado, você pode executar yarn watch:static para executar automaticamente o script toda vez que houver alguma mudança no diretório bookwyrm/static.
Before submitting patch, you should check ruff and other formatting tools. For those to work nicely, you should make sure you have development web-container and dev-tools build.
./bw-dev dev build # This is needed only once, if you haven't run dev stack previously
./bw-dev dev build dev-tools # This is needed only once and if you change pyproject.toml or Dockerfile
After those commands, you can run formatters and pytest and mypy with bw-dev command:
./bw-dev formatters
./bw-dev mypy
./bw-dev pytest
In .env.dev:
DOMAIN to to the domain name you are using (e.g. abcd-1234.ngrok-free.app).PORT=1333).Check that you have all the required settings configured before proceeding.
If you try to register your admin account and see a message that CSRF verification failed you may have set your domain or port incorrectly.
If you want to test sending emails, you will need to set up appropriate real values in the "Email config" section. You do not need to change anything for the separate EMAIL setting. These settings are in .env -file