Blame
edc220 | Ralph Thesen | 2024-02-12 20:09:01 | 1 | # Development |
2 | ||||
3 | ## Contributing | |||
4 | ||||
5 | Thank you for considering contributing to An Otter Wiki! If you ran into a problem or want to request a feature, please check the existing [issues](https://github.com/redimp/otterwiki/issues) in case someone else had a similar request and support their case or open a new issue. If you want to contribute code, design or documentation directly, please [fork](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/fork-a-repo) the [repository](https://github.com/redimp/otterwiki) on <i class="fab fa-github"></i> github. Please make sure all tests pass and submit your changes as a pull request. | |||
6 | ||||
7 | ## Setting up a development environment | |||
8 | ||||
9 | 1. Install the prerequisites | |||
10 | - Debian / Ubuntu | |||
11 | ```bash | |||
12 | apt install git build-essential python3-dev python3-venv | |||
13 | ``` | |||
14 | - RHEL8 / Fedora / Centos8 / Rocky Linux 8 | |||
15 | ```bash | |||
16 | yum install make python3-devel | |||
17 | ``` | |||
18 | - MacOS | |||
19 | ```bash | |||
20 | brew install python3 | |||
21 | ``` | |||
22 | 2. Clone the repository (in case you've created a fork, replace the url with your repository) and enter the directory | |||
23 | ```bash | |||
24 | git clone https://github.com/redimp/otterwiki.git && cd otterwiki | |||
25 | ``` | |||
26 | 3. Create and initialize the repository where the data is stored | |||
27 | ```bash | |||
28 | mkdir -p app-data/repository | |||
29 | # initialize the empty repository | |||
30 | git init app-data/repository | |||
31 | ``` | |||
32 | 4. Create a minimal configuration file | |||
33 | ```bash | |||
34 | echo "REPOSITORY='${PWD}/app-data/repository'" >> settings.cfg | |||
35 | echo "SQLALCHEMY_DATABASE_URI='sqlite:///${PWD}/app-data/db.sqlite'" >> settings.cfg | |||
36 | echo "SECRET_KEY='$(echo $RANDOM | md5sum | head -c 16)'" >> settings.cfg | |||
37 | ``` | |||
38 | 5. Run `make` to setup a virtual environemnt and run a local server on port 8080 | |||
39 | ```bash | |||
40 | make debug | |||
41 | ``` | |||
42 | 6. Open the wiki in your browser <http://127.0.0.1:8080>. You can create and edit pages as anonymous user without any further configuration. Please note: This setup is not for production use! | |||
43 | 7. While you edit the code, flask will automatically reload the server. | |||
44 | 8. Run tests | |||
45 | ```bash | |||
46 | make test | |||
47 | ``` | |||
48 | 9. Run coverage tests | |||
49 | ```bash | |||
50 | make coverage | |||
51 | ``` | |||
52 | and check `coverage_html/index.html` for detailed information. |