You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/contributing/install-dev.md
+29-15Lines changed: 29 additions & 15 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
Title: Developer Environment
3
-
Date: 2021-04-12
3
+
Date: 2025-05-26
4
4
Order: 5
5
5
---
6
6
@@ -10,32 +10,46 @@ These instructions assume you are developing BookWyrm using Docker. You'll need
10
10
11
11
## Setting up the developer environment
12
12
13
-
- Get a copy of [the BookWyrm codebase from GitHub](https://github.com/bookwyrm-social/bookwyrm). You can [create a fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of the repository, and then [use `git clone` to download the code](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository) to your computer.
14
-
- Go to the directory which contains the code on your computer, you'll be working from there from here on out.
15
-
- Set up your development environment variables file by copying the example environment file (`.env.example`) into a new file named `.env`. In the command line, you can do this with:
13
+
### Get the code
14
+
15
+
1. Get a copy of [the BookWyrm codebase from GitHub](https://github.com/bookwyrm-social/bookwyrm). You can [create a fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo) of the repository, and then [use `git clone` to download the code](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository-from-github/cloning-a-repository) to your computer.
16
+
2. Go to the directory which contains the code on your computer, you'll be working from there from here on out.
17
+
3. Set up your development environment variables file by copying the example environment file (`.env.example`) into a new file named `.env`. In the command line, you can do this with:
16
18
```{ .sh }
17
19
cp .env.example .env
18
20
```
19
-
- In `.env`, change `DEBUG` to `true`
20
-
- Optionally, you can use a service like [ngrok](https://ngrok.com/) to set up a domain name, and set the `DOMAIN` variable in your `.env` file to the domain name generated by ngrok.
21
-
- Unless you want to set up your local machine to support https during development, you may want to set `USE_HTTPS=false`. If you try to register your admin account and see a message that `CSRF verification failed`, you should set this option.
22
21
23
-
- Set up nginx for development by copying the developer nginx configuration file (`nginx/development`) into a new file named `nginx/default.conf`:
24
-
```{ .sh }
25
-
cp nginx/development nginx/default.conf
26
-
```
22
+
### Configure your environment settings
23
+
24
+
In `.env`:
25
+
26
+
4. change `DEBUG` to `true`
27
+
5. If you use a tunneling/proxy service like [ngrok](https://ngrok.com), set `DOMAIN` to to the domain name you are using (e.g. `abcd-1234.ngrok-free.app`). Otherwise, set `DOMAIN` to `localhost`
28
+
6. change `NGINX_SETUP` to `reverse_proxy` (this prevents BookWyrm trying to set up https certificates on your development machine)
29
+
7. If you need to use a particular port (e.g. if you are tunneling via ngrok), uncomment `PORT` and set it (e.g. `PORT=1333`). If using `localhost` this is optional.
30
+
31
+
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.
32
+
33
+
### Email (optional)
34
+
35
+
If you want to test sending emails, you will need to [set up appropriate values](/environment.html#email-configuration) in the "Email config" section. You do not need to change anything for [the separate `EMAIL` setting](/environment.html#email).
36
+
37
+
### Build and run
38
+
39
+
8. In the command line, run:
27
40
28
-
- Start the application. In the command line, run:
29
41
```{ .sh }
30
42
./bw-dev build # Build the docker images
31
43
./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.
32
44
./bw-dev up # Start the docker containers
33
45
```
34
-
- Once the build is complete, you can access the instance at `http://localhost:1333` and create an admin user.
46
+
47
+
9. Once the build is complete, you can access the instance at `http://localhost`, your ngrok domain, or `http://localhost:{PORT}`, depending on you domain and port configuration.
48
+
10. You can now enter your admin key and create an admin user. From here everything is the same as described in "Running BookWyrm".
35
49
36
50
If you're curious: the `./bw-dev` command is a simple shell script runs various other tools: above, you could skip it and run `docker-compose build` or `docker-compose up` directly if you like. `./bw-dev` just collects them into one common place for convenience. Run it without arguments to get a list of available commands, read the [documentation page](/cli.html) for it, or open it up and look around to see exactly what each command is doing!
37
51
38
-
###Editing or creating Models
52
+
## Editing or creating Models
39
53
40
54
If you change or create a model, you will probably change the database structure. For these changes to have effect you will need to run Django's `makemigrations` command to create a new [Django migrations file](https://docs.djangoproject.com/en/3.2/topics/migrations), and then `migrate` it:
41
55
@@ -44,7 +58,7 @@ If you change or create a model, you will probably change the database structure
44
58
./bw-dev migrate
45
59
```
46
60
47
-
###Editing static files
61
+
## Editing static files
48
62
Any time you edit the CSS or JavaScript, you will need to run Django's `collectstatic` command again in order for your changes to have effect:
0 commit comments