Skip to content

Commit 60fe637

Browse files
hd1exAlexander Sommer
andauthored
Add description and settings for a dev setup (#39)
Co-authored-by: Alexander Sommer <alexander.sommer@hadiko.de>
1 parent 40d63f5 commit 60fe637

File tree

3 files changed

+105
-8
lines changed

3 files changed

+105
-8
lines changed

README.md

Lines changed: 70 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Shiftings
22

3-
This is a simple shift management system. Built and maintained by students from the self-governed student dormatory [HaDiKo](https://www.hadiko.de/).
3+
This is a simple shift management system. Built and maintained by students from the self-governed student dormitory [HaDiKo](https://www.hadiko.de/).
44

55
## Description
66

@@ -13,21 +13,84 @@ We plan on adding functionality for managing a high density of Shifts in a short
1313

1414
## Getting Started
1515

16-
### Requirements
16+
### Development / Local setup
1717

18-
* Python >= 3.9
19-
* Gunicorn or similar WSGI/ASGI Server
18+
This section describes a quick local setup for development or testing out the software running and getting accessed on a single PC.
2019

21-
### Installing
20+
#### Clone the repository
2221

23-
See [django docs](https://docs.djangoproject.com/en/4.1/howto/deployment/) for details on how to deploy a django application.
22+
Start by cloning the repository and change your working directory to it:
23+
24+
```shell
25+
git clone https://github.com/HaDiNet/shiftings
26+
cd shiftings
27+
```
28+
29+
#### Install dependencies
30+
31+
This software depends on python and its package index. The pip dependencies are listed in [pyproject.toml](pyproject.toml).
32+
33+
##### Manage dependencies using venv
34+
35+
You can manage your (virtual) python environment for this project using [venv](https://repology.org/project/python%3Avirtualenv/packages) and [pip](https://repology.org/project/python%3Apip/packages).
36+
Make sure they are installed on your system and run the following setup commands:
37+
38+
```shell
39+
python -m venv venv
40+
source venv/bin/activate # Linux, BSD, MacOS
41+
# venv\Scripts\activate # Windows
42+
pip install .
43+
```
44+
45+
Make sure to activate your venv (second line above) in every shell you want to interact with your venv. Some IDEs do this automatically for you.
46+
47+
By running `src/manage.py` you can [run Django commands and do administration](https://docs.djangoproject.com/en/5.1/ref/django-admin/).
48+
49+
#### Local settings
50+
51+
The [project settings](src/shiftings/settings.py) are already setup for development mode (`DEBUG = True`). Feel free to have a look at the settings or adapt them to your needs. If you just want to try out the software, no action is required.
52+
53+
#### Database setup
54+
55+
The script [setup_db.sh](setup_db.sh) initializes your database with the schema matching the shiftings models (running `manage.py migrate`) and [loading the fixtures](https://docs.djangoproject.com/en/5.1/howto/initial-data/) providing example data. Execute it for having a local database:
56+
57+
```shell
58+
sh setup_db.sh
59+
```
60+
61+
#### Development server
62+
63+
Django provides a simple development server supporting live reload on code change. You can run it with the following command:
64+
65+
```shell
66+
python src/manage.py runserver
67+
```
68+
69+
After that you can access your local shiftings instance at <http://127.0.0.1:8000/>.
70+
71+
#### User fixtures
72+
73+
In development mode you can switch between the pre-defined user fixtures with a button in the context menu at the top right of the web page or you can login using the lower case name as username and password (`bob`, `perry` etc.). **Bob** is a superuser and has access to the [Django admin page](http://127.0.0.1:8000/admin/) and **Perry** is a staff member. The other users have [different access to the first example organization](http://127.0.0.1:8000/organizations/1/admin/) provided by the fixture. Follow the provided links for more info.
74+
75+
#### Upgrade Django version
76+
77+
View the [Django documentation for upgrading Django projects](https://docs.djangoproject.com/en/5.1/howto/upgrade-version/). After switching to an newer version, make sure there are no warnings or errors by running
78+
79+
```shell
80+
python -W all src/manage.py check --deploy
81+
```
82+
83+
### Deployment / Shared setup
84+
85+
This section describes a shared setup deployed on a server for common use in an organization.
86+
87+
See [Django docs](https://docs.djangoproject.com/en/4.1/howto/deployment/) for details on how to deploy a Django application.
2488

2589
1. Clone the repository
2690
1. Configure your WSGI Server
2791
1. Add a local_settings.py. See local_settings.sample.py for inspiration.
2892
1. Add a cron, systemd timer unit or similar for recurring shift creation
2993

30-
3194
## Authors
3295

3396
[lewellien](https://github.com/lewellien) & [Tjeri](https://github.com/tjeri)

src/shiftings/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
FEATURES = {
5757
'event': False, # enable events for organizations
5858
'registration': True, # enable local registration
59-
'gdpr_template': None # add a template for gpdr compliancy information
59+
'gdpr_template': 'local/gdpr_template.sample.html' # add a template for gpdr compliancy information
6060
}
6161

6262
MIDDLEWARE = [
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<div>
2+
<div>
3+
<a href="#datenschutzModal" data-bs-toggle="modal" role="button" class="link">
4+
Durch das Einloggen/Registrieren stimmst du der Verarbeitung deiner personenbezogenen Daten zu.<br>
5+
(Klick hier für Details)
6+
<hr>
7+
By logging in/registering, you consent to the processing of your personal data.<br>
8+
(click here for details)
9+
10+
</a>
11+
</div>
12+
<div class="modal fade text-start" id="datenschutzModal" tabindex="-1" aria-labelledby="{{ modal_id }}ModalLabel"
13+
aria-hidden="true">
14+
<div class="modal-dialog modal-dialog-centered" style="--bs-modal-width: 80vmin">
15+
<div class="modal-content bg-dark border-success border-2">
16+
<div class="modal-header">
17+
<h5 class="modal-title" id="{{ modal_id }}Label">
18+
Datenschutzerklärung / Terms of privacy
19+
</h5>
20+
<button type="button" class="btn btn-secondary btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
21+
</div>
22+
<div class="modal-body">
23+
<div>
24+
<h1>Privacy</h1>
25+
<h2>Very important terms of privacy not so important for a dev setup</h2>
26+
</div>
27+
</div>
28+
<div class="modal-footer">
29+
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
30+
</div>
31+
</div>
32+
</div>
33+
</div>
34+
</div>

0 commit comments

Comments
 (0)