Skip to content

Commit 971c6a9

Browse files
committed
agriculture: fix small changes
- Wind direction in dashboard - Server errors in history - Accumulated rain in dashboard - Rain limits - Reduce refreshing time Signed-off-by: Victor Coman <victor.coman@digi.com>
1 parent 464fdfe commit 971c6a9

File tree

16 files changed

+132
-55
lines changed

16 files changed

+132
-55
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
option_settings:
2+
aws:elasticbeanstalk:container:python:
3+
WSGIPath: agriculturecommon.wsgi:application
4+
aws:elasticbeanstalk:environment:proxy:staticfiles:
5+
/static: static

agriculture/.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# Elastic Beanstalk Files
3+
.elasticbeanstalk/*
4+
!.elasticbeanstalk/*.cfg.yml
5+
!.elasticbeanstalk/*.global.yml

agriculture/Procfile.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
web: gunicorn --bind :8000 --workers 3 --threads 2 agriculturecommon.wsgi:application
2+
websocket: daphne -b :: -p 5000 agriculturecommon.asgi:application

agriculture/agriculturecommon/settings.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
# SECURITY WARNING: don't run with debug turned on in production!
4040
DEBUG = True
4141

42-
ALLOWED_HOSTS = []
42+
ALLOWED_HOSTS = ['127.0.0.1', 'django-env5.us-west-2.elasticbeanstalk.com', '172.31.27.57']
4343

4444

4545
# Application definition
@@ -93,7 +93,7 @@
9393
DATABASES = {
9494
'default': {
9595
'ENGINE': 'django.db.backends.sqlite3',
96-
'NAME': BASE_DIR / 'db.sqlite3',
96+
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
9797
}
9898
}
9999

agriculture/agriculturecommon/urls.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131
from django.urls import include, path
3232

3333
urlpatterns = [
34+
35+
# path("index.html", include("app.urls")),
36+
3437
path("access/", include("login.urls")),
3538

3639
path("", include("agriculturecore.urls")),

agriculture/agriculturecore/templates/dashboard.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ <h6 class="card-title">Weather station</h6>
8888
<td><span class="digi-icon-color fas fa-sun fa-2x"></span></td>
8989
</tr>
9090
<tr>
91-
<td><span id="wind_speed"><i class="fas fa-circle-notch fa-spin"></i></span> km/h</td>
92-
<td><span id="rain_diff"><i class="fas fa-circle-notch fa-spin"></i></span> L/m²</td>
91+
<td><span id="wind_speed"><i class="fas fa-circle-notch fa-spin"></i></span> km/h (<span id="wind_direction"><i class="fas fa-circle-notch fa-spin"></i></span>)
92+
93+
</td>
94+
<td><span id="rain_acc"><i class="fas fa-circle-notch fa-spin"></i></span> L/m²</td>
9395
<td><span id="luminosity"><i class="fas fa-circle-notch fa-spin"></i></span> lux</td>
9496
</tr>
9597
</tbody>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
9+
</body>
10+
</html>

agriculture/agriculturecore/views.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
"agriculture demo."
3939

4040

41+
def farms_map(request):
42+
if is_authenticated(request):
43+
if request.method == "GET":
44+
return TemplateResponse(request, 'map.html')
45+
else:
46+
return redirect_login(request)
47+
48+
4149
def dashboard(request):
4250
if not request_has_params(request):
4351
return redirect("/")
@@ -74,14 +82,6 @@ def schedule(request):
7482
return redirect_login(request)
7583

7684

77-
def farms_map(request):
78-
if is_authenticated(request):
79-
if request.method == "GET":
80-
return TemplateResponse(request, 'map.html')
81-
else:
82-
return redirect_login(request)
83-
84-
8585
def verify_parameters(request):
8686
"""
8787
Verifies the URL parameters to check if the given farm name and controller

agriculture/index.html

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Title</title>
6+
</head>
7+
<body>
8+
9+
</body>
10+
</html>

agriculture/requirements.txt

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
1-
arrow==0.12.1
2-
asgiref==3.2.10
3-
backports.functools-lru-cache==1.6.1
4-
certifi==2018.4.16
5-
channels==3.0.2
6-
chardet==3.0.4
7-
devicecloud==0.5.7
8-
Django==3.1
9-
idna==2.10
10-
python-dateutil==2.7.5
11-
pytz==2020.1
12-
requests==2.20.1
13-
six==1.14.0
14-
sqlparse==0.3.1
15-
urllib3==1.25.10
16-
17-
django-pjax~=1.7
1+
arrow==0.12.1
2+
asgiref==3.2.10
3+
backports.functools-lru-cache==1.6.1
4+
certifi==2018.4.16
5+
channels==3.0.3
6+
chardet==3.0.4
7+
devicecloud==0.5.7
8+
Django==2.2
9+
idna
10+
python-dateutil==2.7.5
11+
pytz==2020.1
12+
requests==2.20.1
13+
six==1.14.0
14+
sqlparse==0.3.1
15+
urllib3
16+
django-pjax~=1.7
17+
supervisor==4.2.2
18+
gunicorn==20.0.4
19+
daphne==3.0.1
20+
channels-redis==3.2.0

0 commit comments

Comments
 (0)