now working on linux with mariadb
This commit is contained in:
@@ -22,6 +22,7 @@ import sqlalchemy as sa
|
|||||||
|
|
||||||
from rowsandall_app.settings import DATABASES
|
from rowsandall_app.settings import DATABASES
|
||||||
from rowsandall_app.settings_dev import DATABASES as DEV_DATABASES
|
from rowsandall_app.settings_dev import DATABASES as DEV_DATABASES
|
||||||
|
from rowsandall_app.settings_dev import use_sqlite
|
||||||
|
|
||||||
from rowers.utils import lbstoN
|
from rowers.utils import lbstoN
|
||||||
|
|
||||||
@@ -58,8 +59,13 @@ database_url = 'mysql://{user}:{password}@{host}:{port}/{database_name}'.format(
|
|||||||
|
|
||||||
database_name_dev = DEV_DATABASES['default']['NAME']
|
database_name_dev = DEV_DATABASES['default']['NAME']
|
||||||
|
|
||||||
|
database_url_debug = database_url
|
||||||
|
|
||||||
|
if use_sqlite:
|
||||||
database_url_debug = 'sqlite:///'+database_name_dev
|
database_url_debug = 'sqlite:///'+database_name_dev
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# mapping the DB column names to the CSV file column names
|
# mapping the DB column names to the CSV file column names
|
||||||
columndict = {
|
columndict = {
|
||||||
'time':'TimeStamp (sec)',
|
'time':'TimeStamp (sec)',
|
||||||
@@ -728,7 +734,7 @@ def fitnessmetric_to_sql(m,table='powertimefitnessmetric',debug=False,
|
|||||||
engine = create_engine(database_url, echo=False)
|
engine = create_engine(database_url, echo=False)
|
||||||
|
|
||||||
columns = ', '.join(m.keys())
|
columns = ', '.join(m.keys())
|
||||||
if debug:
|
if use_sqlite:
|
||||||
placeholders = ", ".join(["?"] * len(m))
|
placeholders = ", ".join(["?"] * len(m))
|
||||||
else:
|
else:
|
||||||
placeholders = ", ".join(["%s"] * len(m))
|
placeholders = ", ".join(["%s"] * len(m))
|
||||||
|
|||||||
@@ -1121,6 +1121,9 @@ def fitnessmetric_chart(fitnessmetrics,user,workoutmode='rower',startdate=None,
|
|||||||
except TypeError:
|
except TypeError:
|
||||||
df = pd.DataFrame()
|
df = pd.DataFrame()
|
||||||
|
|
||||||
|
if df.empty:
|
||||||
|
return ["","no data"]
|
||||||
|
|
||||||
groups = df.groupby(by='date').max()
|
groups = df.groupby(by='date').max()
|
||||||
|
|
||||||
power4min = groups['power4min']
|
power4min = groups['power4min']
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ if TESTING or use_sqlite:
|
|||||||
'ENGINE': 'django.db.backends.sqlite3',
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
'NAME': os.path.join(BASE_DIR, 'db.sqlite3'),
|
||||||
'HOST': 'localhost',
|
'HOST': 'localhost',
|
||||||
},
|
'PASSWORD': 'roeidata',
|
||||||
|
'PORT': '3306', },
|
||||||
# 'TEST': {
|
# 'TEST': {
|
||||||
# 'CHARSET': 'utf8',
|
# 'CHARSET': 'utf8',
|
||||||
# 'COLLATION': 'utf8_general_ci',
|
# 'COLLATION': 'utf8_general_ci',
|
||||||
@@ -37,9 +38,7 @@ if TESTING or use_sqlite:
|
|||||||
# 'ENGINE': 'django.db.backends.mysql',
|
# 'ENGINE': 'django.db.backends.mysql',
|
||||||
# 'NAME': 'rowsanda_107501',
|
# 'NAME': 'rowsanda_107501',
|
||||||
# 'USER': 'rowsanda_107501',
|
# 'USER': 'rowsanda_107501',
|
||||||
# 'PASSWORD': 'roeidata',
|
|
||||||
# 'HOST': 'store3.rosti.cz',
|
|
||||||
# 'PORT': '3306',
|
|
||||||
# }
|
# }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user