Te instrukcje zakładają, że rozwijasz BookWyrm przy użyciu Docker. Aby rozpocząć, należy zainstalować Docker i docker-compose.
git clone
, aby pobrać kod na swój komputer..env.example
) do nowego pliku o nazwie .env
. W wierszu polecenia można to zrobić następująco:cp .env.example .env
In .env
:
DEBUG
to true
DOMAIN
to to the domain name you are using (e.g. abcd-1234.ngrok-free.app
). Otherwise, set DOMAIN
to localhost
NGINX_SETUP
to reverse_proxy
(this prevents BookWyrm trying to set up https certificates on your development machine)PORT
and set it (e.g. PORT=1333
). If using localhost
this is optional.If you try to register your admin account and see a message that CSRF verification failed
, you should check these settings, as you may have set your domain or port incorrectly.
If you want to test sending emails, you will need to set up appropriate values in the "Email config" section. You do not need to change anything for the separate EMAIL
setting.
./bw-dev build # Build the docker images
./bw-dev setup # Initialize the database and run migrations. Note the ADMIN key at the end of this output. You'll need it to register the first admin user.
./bw-dev up # Start the docker containers
http://localhost
, your ngrok domain, or http://localhost:{PORT}
, depending on you domain and port configuration.Dla ciekawskich: polecenie ./bw-dev
to prosty skrypt uruchamiający wiele różnych narzędzi: powyżej możesz pominąć je i wykonać docker-compose build
lub docker-compose up
bezpośrednio, jeśli chcesz. ./bw-dev
po prostu gromadzi je wszystkie w jednym miejscu. 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!
Zmieniając lub tworząc model prawdopodobnie ulegnie zmianie struktura bazy danych. Aby te zmiany zostały zastosowane, należy uruchomić polecenie Django makemigrations
, aby utworzyć nowy plik migracji Django, a następnie przenieść go (migrate
):
./bw-dev makemigrations
./bw-dev migrate
Za każdym razem, gdy edytujesz CSS lub JavaScript, należy ponownie uruchomić polecenie Django collectstatic
, aby miany zostały zastosowane:
./bw-dev collectstatic
Jeśli zainstalowano yarn, możesz wykonać yarn watch:static
, aby automatycznie wykonać poprzedni skrypt za każdym razem, gdy zajdzie zmiana w katalogu bookwyrm/static
.