Compare commits
4 Commits
b7134dbc0f
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 3193c6d507 | |||
| 4cfac906ac | |||
| 61918546b7 | |||
| bb50382809 |
@@ -12,11 +12,14 @@ Nur ein Mal zu initialisieren:
|
|||||||
git clone https://github.com/clerie/wetter.git
|
git clone https://github.com/clerie/wetter.git
|
||||||
cd wetter/
|
cd wetter/
|
||||||
virtualenv -p python3 ENV
|
virtualenv -p python3 ENV
|
||||||
cp wetter/config/db.py.example wetter/config/db.py
|
|
||||||
cd ..
|
cd ..
|
||||||
```
|
```
|
||||||
|
|
||||||
Passe nun `wetter/config/db.py` mit deinen Datenbankzugangsdaten an.
|
Erstelle eine `config.cfg` mit folgendem Inhalt und passe die Werte entsprechend an.
|
||||||
|
|
||||||
|
```
|
||||||
|
SQLALCHEMY_DATABASE_URI=postgresql://user:password@host:5432/database
|
||||||
|
```
|
||||||
|
|
||||||
Bei Bedarf musst du noch die `wsgi.ini` anpassen.
|
Bei Bedarf musst du noch die `wsgi.ini` anpassen.
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"@rollup/plugin-node-resolve": "^7.1.1",
|
"@rollup/plugin-node-resolve": "^7.1.1",
|
||||||
"rollup": "^1.32.1",
|
"rollup": "^1.32.1",
|
||||||
"rollup-plugin-copy": "^3.3.0",
|
"rollup-plugin-copy": "^3.3.0",
|
||||||
"rollup-plugin-scss": "^2.1.0",
|
"rollup-plugin-scss": "^3.0.0",
|
||||||
"rollup-plugin-terser": "^5.3.0"
|
"rollup-plugin-terser": "^5.3.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
@@ -31,6 +31,7 @@
|
|||||||
"datatables.net-bs4": "^1.10.20",
|
"datatables.net-bs4": "^1.10.20",
|
||||||
"jquery": "^3.4.1",
|
"jquery": "^3.4.1",
|
||||||
"leaflet": "^1.6.0",
|
"leaflet": "^1.6.0",
|
||||||
|
"node-sass": "^7.0.1",
|
||||||
"popper.js": "^1.16.1"
|
"popper.js": "^1.16.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
from wetter.config.db import db as config_db
|
|
||||||
|
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
from flask_sqlalchemy import SQLAlchemy
|
from flask_sqlalchemy import SQLAlchemy
|
||||||
import flask_excel as excel
|
import flask_excel as excel
|
||||||
@@ -10,7 +8,9 @@ app = Flask(__name__)
|
|||||||
excel.init_excel(app)
|
excel.init_excel(app)
|
||||||
|
|
||||||
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
|
||||||
app.config["SQLALCHEMY_DATABASE_URI"] = config_db['uri']
|
|
||||||
|
# override configs from file
|
||||||
|
app.config.from_envvar('WETTER_SETTINGS')
|
||||||
|
|
||||||
db = SQLAlchemy(app)
|
db = SQLAlchemy(app)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
#!/usr/bin/env python3
|
|
||||||
|
|
||||||
db = {}
|
|
||||||
db['uri'] = "postgresql://user:password@host:5432/database"
|
|
||||||
@@ -40,7 +40,7 @@
|
|||||||
zoomOffset: -1
|
zoomOffset: -1
|
||||||
}).addTo(mymap);
|
}).addTo(mymap);
|
||||||
|
|
||||||
$.getJSON("/api/station", (stations) => {
|
$.getJSON("/api/station/", (stations) => {
|
||||||
if(stations.length == 1) {
|
if(stations.length == 1) {
|
||||||
mymap.setView([stations[0]["lat"], stations[0]["lon"]], 6);
|
mymap.setView([stations[0]["lat"], stations[0]["lon"]], 6);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -86,7 +86,7 @@
|
|||||||
zoomOffset: -1
|
zoomOffset: -1
|
||||||
}).addTo(mymap);
|
}).addTo(mymap);
|
||||||
|
|
||||||
$.getJSON("/api/station?s={{ station.dwd_id }}", (stations) => {
|
$.getJSON("/api/station/?s={{ station.dwd_id }}", (stations) => {
|
||||||
if(stations.length == 1) {
|
if(stations.length == 1) {
|
||||||
mymap.setView([stations[0]["lat"], stations[0]["lon"]], 6);
|
mymap.setView([stations[0]["lat"], stations[0]["lon"]], 6);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user