Ces instructions supposent que vous développez BookWyrm en utilisant Docker. Vous devrez installer Docker et docker-compose avant toute chose.
git clone
pour télécharger le code sur votre ordinateur..env.example
) dans un nouveau fichier nommé .env
. En ligne de commande, vous pouvez le faire en tapant :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.Pour les curieux·ses : la commande ./bw-dev
est un simple script shell qui exécute divers autres outils ; au lieu des commandes ci-dessus, vous auriez pu exécuter docker-compose build
ou docker-compose up
directement si vous le souhaitez. ./bw-dev
les rassemble dans un seul endroit pour plus de commodité. 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!
Si vous créez ou modifiez un modèle, vous changerez probablement la structure de la base de données. Pour que ces changements aient des effets, vous devrez utiliser la commande makemigrations
de Django pour créer un nouveau fichier de migration Django, puis la commande migrate
pour le migrer :
./bw-dev makemigrations
./bw-dev migrate
Chaque fois que vous éditez du CSS ou du JavaScript, vous devrez exécuter la commande collectstatic
de Django pour que vos changements aient un effet :
./bw-dev collectstatic
Si vous avez installé yarn, vous pouvez exécuter yarn watch:static
qui va exécuter automatiquement le script précédent à chaque fois qu'un changement se produit dans le répertoire bookwyrm/static
.