Skip to content

Commit 92885f2

Browse files
committed
Merge branch 'master' into release/0.1.x
2 parents ad4935e + ca1ae3f commit 92885f2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+808
-131
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
* text eol=lf
1+
*.vue text eol=lf

Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,21 @@ deploy_prod:
2727
source env.hosts.prod && ssh $$DJANGO_PROD_HOST -t "cd $$DJANGO_PROD_PATH && COMPOSE_FILE=$$COMPOSE_PROD docker-compose up -d"
2828
source env.hosts.prod && rsync -av --delete vue/dist $$DJANGO_PROD_HOST:$$VUE_PROD_PATH
2929
source env.hosts.prod && ssh $$DJANGO_PROD_HOST -t "cd $$DJANGO_PROD_PATH && COMPOSE_FILE=$$COMPOSE_PROD docker-compose exec django make migrate"
30-
source env.hosts.prod && ssh $$DJANGO_PROD_HOST -t "cd $$DJANGO_PROD_PATH && COMPOSE_FILE=$$COMPOSE_PROD docker-compose exec django killall -TERM uvicorn"
30+
source env.hosts.prod && ssh $$DJANGO_PROD_HOST -t "cd $$DJANGO_PROD_PATH && COMPOSE_FILE=$$COMPOSE_PROD docker-compose exec django killall -TERM gunicorn"
3131

3232
deploy_dev:
3333
cd vue && make build
3434
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && git pull -v"
3535
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && COMPOSE_FILE=$$COMPOSE_DEV docker-compose up -d"
3636
source env.hosts.prod && rsync -av --delete vue/dist $$DJANGO_DEV_HOST:$$VUE_DEV_PATH
37-
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && COMPOSE_FILE=$$COMPOSE_DEV docker-compose exec django ls"
38-
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && COMPOSE_FILE=$$COMPOSE_DEV docker-compose exec django killall -TERM uvicorn"
37+
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && COMPOSE_FILE=$$COMPOSE_DEV docker-compose exec django make migrate"
38+
source env.hosts.prod && ssh $$DJANGO_DEV_HOST -t "cd $$DJANGO_DEV_PATH && COMPOSE_FILE=$$COMPOSE_DEV docker-compose exec django killall -TERM gunicorn"
3939

4040
ab-graphql:
4141
ab -p tests/graphql-autocomplete-post.json -T application/json -c 10 -n 2000 http://gemeindescan.ch/graphql/
4242

4343
ab-html:
4444
ab -c 10 -n 2000 http://gemeindescan.ch/
45+
46+
dump-db:
47+
@docker-compose exec pdb sh -c 'pg_dump --no-owner --no-acl --schema=public -U $$POSTGRES_USER $$POSTGRES_DB'

README.md

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,20 @@
1-
# gemeindescan-webui
1+
# Gemeindescan Web UI
2+
3+
Web application under heavy development. For more information, please visit https://cividi.ch
4+
5+
The current tech stack of this project is:
6+
7+
- Vuetify
8+
- Vue.js
9+
- GraphQL
10+
- Graphene
11+
- Django
12+
- Wagtail
13+
- Docker
14+
15+
# Developer guide
16+
17+
:construction:
218

319
## setup project
420

@@ -53,7 +69,7 @@ make up
5369
make init
5470
```
5571

56-
if `make init` doesn't work you can execute the commands one by one.
72+
if `make init` doesn't work you can execute the commands one by one.
5773

5874
```bash
5975
# go into django container
@@ -74,16 +90,16 @@ ln -s /node_modules ./
7490
make up
7591
```
7692

77-
### editor
93+
### editor
7894

7995
The project is setup to work with visual studio code as editor. Any other editor is also fine.
80-
With vscode the plugins are automatically installed and linting and autocomplete works out of the box,
81-
with the data from inside the container.
96+
With vscode the plugins are automatically installed and linting and autocomplete works out of the box,
97+
with the data from inside the container.
8298

83-
You need to have installed the vscode extension `Remote - Containers` in your local vscode installation.
99+
You need to have installed the vscode extension `Remote - Containers` in your local vscode installation.
84100

85101
You need to start two editors with `code vue` and `code django` (install code command in path from vscode).
86-
After they started you need to click on `reopen in container` (first time start takes a bit longer to install plugins).
102+
After they started you need to click on `reopen in container` (first time start takes a bit longer to install plugins).
87103

88104
#### vue vscode
89105

django/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
GEMEINDESCAN_WEBUI_DJANGO=0.1.0
1+
GEMEINDESCAN_WEBUI_DJANGO=0.2.0
22
DOCKER_DJANGO_NAME=$(shell basename $(shell dirname `pwd`))_django_1
33
DOCKER_EXEC=$(shell command -v docker > /dev/null && echo "docker exec -it $(DOCKER_DJANGO_NAME)")
44

django/docker/django/Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM alpine:3.10
1+
FROM alpine:3.11
22
MAINTAINER Yves Serrano <[email protected]>
33
ARG S6_OVERLAY_VERSION=v1.22.1.0
44
# https://github.com/just-containers/s6-overlay
@@ -11,6 +11,9 @@ RUN apk add --update \
1111
curl \
1212
libpq \
1313
python3 \
14+
py3-pillow \
15+
py3-gunicorn \
16+
py3-psycopg2 \
1417
libressl \
1518
make \
1619
jq
@@ -33,7 +36,6 @@ RUN apk add \
3336
yaml-dev \
3437
g++ \
3538
gcc \
36-
postgresql-dev \
3739
libressl-dev \
3840
&& pip3 install -r /tmp/requirements.txt \
3941
&& apk del \
@@ -47,7 +49,6 @@ RUN apk add \
4749
yaml-dev \
4850
g++ \
4951
gcc \
50-
postgresql-dev \
5152
libressl-dev \
5253
&& apk add libstdc++ \
5354
&& rm -rf /var/cache/apk/* /tmp/*

django/docker/django/requirements.txt

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
aniso8601==7.0.0
2+
appdirs==1.4.3
23
asgiref==3.2.3
34
astroid==2.3.3
45
Click==7.0
5-
Django==3.0.2
6+
Django==3.0.3
67
django-cors-headers==3.2.1
78
django-filter==2.2.0
89
docopt==0.6.2
910
graphene==2.1.8
10-
graphene-django==2.8.0
11+
graphene-django==2.8.1
1112
graphql-core==2.2.1
1213
graphql-relay==2.0.1
13-
gunicorn==20.0.4
1414
h11==0.9.0
1515
httptools==0.0.13
1616
isort==4.3.21
1717
jedi==0.15.2
1818
lazy-object-proxy==1.4.3
1919
mccabe==0.6.1
20+
olefile==0.46
2021
parso==0.5.2
22+
Pillow==6.2.1
2123
promise==2.3
22-
prompt-toolkit==2.0.10
24+
prompt-toolkit==3.0.3
2325
psycopg2==2.8.4
24-
ptpython==2.0.6
26+
ptpython==3.0.0
2527
Pygments==2.5.2
2628
pylint==2.4.4
2729
pylint-django==2.0.13
@@ -30,9 +32,10 @@ pytz==2019.3
3032
Rx==1.6.1
3133
singledispatch==3.4.0.3
3234
six==1.13.0
35+
sorl-thumbnail==12.6.3
3336
sqlparse==0.3.0
3437
typed-ast==1.4.0
35-
uvicorn==0.11.1
38+
uvicorn==0.11.2
3639
uvloop==0.14.0
3740
wcwidth==0.1.8
3841
websockets==8.1

django/gsmap/admin.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,27 @@
11
from django.contrib import admin
2-
from gsmap.models import Municipality
2+
from django.utils.translation import gettext as _
3+
from gsmap.models import Municipality, Snapshot
34

45

56
class MunicipalityAdmin(admin.ModelAdmin):
67
pass
78

89

10+
class SnapshotAdmin(admin.ModelAdmin):
11+
readonly_fields = (
12+
'created',
13+
)
14+
fieldsets = (
15+
(_('Meta'), {
16+
'fields': ('created', 'id', 'archived', 'deleted')
17+
}),
18+
(_('Main'), {
19+
'fields':
20+
('data', 'screenshot', 'municipality', 'predecessor', 'user'),
21+
}),
22+
)
23+
list_display = ('id', 'created')
24+
25+
926
admin.site.register(Municipality, MunicipalityAdmin)
27+
admin.site.register(Snapshot, SnapshotAdmin)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Generated by Django 3.0.3 on 2020-02-13 17:30
2+
3+
from django.conf import settings
4+
import django.contrib.postgres.fields.jsonb
5+
from django.db import migrations, models
6+
import django.db.models.deletion
7+
import sorl.thumbnail.fields
8+
9+
10+
class Migration(migrations.Migration):
11+
12+
dependencies = [
13+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
14+
('gsmap', '0002_auto_20200130_1554'),
15+
]
16+
17+
operations = [
18+
migrations.CreateModel(
19+
name='Snapshot',
20+
fields=[
21+
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
22+
('slug_hash', models.CharField(max_length=8, unique=True)),
23+
('data', django.contrib.postgres.fields.jsonb.JSONField()),
24+
('screenshot', sorl.thumbnail.fields.ImageField(upload_to='snapshot-screenshots')),
25+
('archived', models.BooleanField(default=False)),
26+
('deleted', models.BooleanField(default=False)),
27+
('predecessor', models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='gsmap.Snapshot')),
28+
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
29+
],
30+
),
31+
]
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Generated by Django 3.0.3 on 2020-02-13 23:41
2+
3+
import django.contrib.postgres.fields.jsonb
4+
from django.db import migrations, models
5+
import gsmap.models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('gsmap', '0003_snapshot'),
12+
]
13+
14+
operations = [
15+
migrations.AlterField(
16+
model_name='snapshot',
17+
name='data',
18+
field=django.contrib.postgres.fields.jsonb.JSONField(default=dict),
19+
),
20+
migrations.AlterField(
21+
model_name='snapshot',
22+
name='slug_hash',
23+
field=models.CharField(default=gsmap.models.create_slug_hash, max_length=8, unique=True),
24+
),
25+
]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Generated by Django 3.0.3 on 2020-02-18 15:58
2+
3+
from django.db import migrations, models
4+
import django.db.models.deletion
5+
import django.utils.timezone
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('gsmap', '0004_auto_20200213_2341'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='snapshot',
17+
name='created',
18+
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
19+
preserve_default=False,
20+
),
21+
migrations.AddField(
22+
model_name='snapshot',
23+
name='municipality',
24+
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, to='gsmap.Municipality'),
25+
),
26+
]

0 commit comments

Comments
 (0)