Add login functionality and basic HTML pages

This commit is contained in:
2020-01-09 03:17:31 +01:00
parent a0a5384e5b
commit 15ac576058
16 changed files with 147 additions and 48 deletions

View File

@@ -3,6 +3,7 @@ from pandas import DataFrame, concat, read_csv
from csv import QUOTE_NONNUMERIC
from database.constants import ADMIN_PW
from os import path
from werkzeug.security import generate_password_hash
def country_conversion(political_unit) -> str:
@@ -40,7 +41,7 @@ def rename_fields(df_list):
new_fields = {
"POLITICAL_UNIT": "country",
"NAME": "name",
"WGMS_ID": "uid",
"WGMS_ID": "id",
"YEAR": "year",
"MEDIAN_ELEVATION": "elevation",
"AREA": "surface",
@@ -57,7 +58,11 @@ def create_databases(df):
"annual_data": "../data/annual_data.csv",
"user": "../data/user.csv",
}
user = {"uid": [7843], "username": ["admin"], "password": [ADMIN_PW]}
user = {
"id": [7843],
"username": ["admin"],
"password_hash": [generate_password_hash(ADMIN_PW)],
}
dataframes = {
"glacier": df[["POLITICAL_UNIT", "NAME", "WGMS_ID"]].drop_duplicates(),
"annual_data": df[["WGMS_ID", "YEAR", "AREA", "MEDIAN_ELEVATION", "LENGTH"]],