From a5d8dbdf0707553fda1a12dccb530053612cb97d Mon Sep 17 00:00:00 2001 From: Sander Roosendaal Date: Sat, 9 Feb 2019 08:18:44 +0100 Subject: [PATCH] improved static url --- rowers/interactiveplots.py | 96 +++++++++++++++++++------------------- rowsandall_app/urls.py | 6 +-- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/rowers/interactiveplots.py b/rowers/interactiveplots.py index f69b5ec0..271455e8 100644 --- a/rowers/interactiveplots.py +++ b/rowers/interactiveplots.py @@ -2001,18 +2001,18 @@ def interactive_windchart(id=0,promember=0): if rowdata == 0: return 0 - dist = rowdata.df.ix[:,'cum_dist'] + dist = rowdata.df.loc[:,'cum_dist'] try: - vwind = rowdata.df.ix[:,'vwind'] - winddirection = rowdata.df.ix[:,'winddirection'] - bearing = rowdata.df.ix[:,'bearing'] + vwind = rowdata.df.loc[:,'vwind'] + winddirection = rowdata.df.loc[:,'winddirection'] + bearing = rowdata.df.loc[:,'bearing'] except KeyError: rowdata.add_wind(0,0) rowdata.add_bearing() - vwind = rowdata.df.ix[:,'vwind'] - winddirection = rowdata.df.ix[:,'winddirection'] - bearing = rowdata.df.ix[:,'winddirection'] + vwind = rowdata.df.loc[:,'vwind'] + winddirection = rowdata.df.loc[:,'winddirection'] + bearing = rowdata.df.loc[:,'winddirection'] rowdata.write_csv(f1,gzip=True) dataprep.update_strokedata(id,rowdata.df) @@ -2091,13 +2091,13 @@ def interactive_streamchart(id=0,promember=0): if rowdata == 0: return "","No Valid Data Available" - dist = rowdata.df.ix[:,'cum_dist'] + dist = rowdata.df.loc[:,'cum_dist'] try: - vstream = rowdata.df.ix[:,'vstream'] + vstream = rowdata.df.loc[:,'vstream'] except KeyError: rowdata.add_stream(0) - vstream = rowdata.df.ix[:,'vstream'] + vstream = rowdata.df.loc[:,'vstream'] rowdata.write_csv(f1,gzip=True) dataprep.update_strokedata(id,rowdata.df) @@ -2300,7 +2300,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='', xaxmax = datadf[xparam].max() xaxmin = datadf[xparam].min() elif xparam=='time': - tseconds = datadf.ix[:,'time'] + tseconds = datadf.loc[:,'time'] xaxmax = tseconds.max() xaxmin = 0 elif xparam == 'workoutid': @@ -2314,7 +2314,7 @@ def interactive_multiflex(datadf,xparam,yparam,groupby,extratitle='', yaxmax = datadf[yparam].max() yaxmin = datadf[yparam].min() elif yparam=='time': - tseconds = datadf.ix[:,'time'] + tseconds = datadf.loc[:,'time'] yaxmax = tseconds.max() yaxmin = 0 elif yparam == 'workoutid': @@ -2517,7 +2517,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0, try: - datadf['x1'] = datadf.ix[:,xparam] + datadf['x1'] = datadf.loc[:,xparam] except KeyError: try: datadf['x1'] = datadf['distance'] @@ -2528,7 +2528,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0, return ['','

No non-zero data in selection

','',''] try: - datadf['y1'] = datadf.ix[:,yparam1] + datadf['y1'] = datadf.loc[:,yparam1] except KeyError: try: datadf['y1'] = datadf['pace'] @@ -2536,7 +2536,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0, return ['','

No non-zero data in selection

','',''] if yparam2 != 'None': try: - datadf['y2'] = datadf.ix[:,yparam2] + datadf['y2'] = datadf.loc[:,yparam2] except KeyError: datadf['y2'] = datadf['y1'] else: @@ -2566,7 +2566,7 @@ def interactive_cum_flex_chart2(theworkouts,promember=0, if yparam1 == 'pace': y_axis_type = 'datetime' - y1mean = datadf.ix[:,'pace'].mean() + y1mean = datadf.loc[:,'pace'].mean() datadf['xname'] = axlabels[xparam] datadf['yname1'] = axlabels[yparam1] @@ -2896,30 +2896,30 @@ def interactive_flex_chart2(id=0,promember=0, pass try: - tseconds = rowdata.ix[:,'time'] + tseconds = rowdata.loc[:,'time'] except KeyError: return '','No time data - cannot make flex plot','','',workstrokesonly try: - rowdata['x1'] = rowdata.ix[:,xparam] + rowdata['x1'] = rowdata.loc[:,xparam] rowmin = rowdata[xparam].min() except KeyError: - rowdata['x1'] = 0*rowdata.ix[:,'time'] + rowdata['x1'] = 0*rowdata.loc[:,'time'] try: - rowdata['y1'] = rowdata.ix[:,yparam1] + rowdata['y1'] = rowdata.loc[:,yparam1] rowmin = rowdata[yparam1].min() except KeyError: - rowdata['y1'] = 0*rowdata.ix[:,'time'] + rowdata['y1'] = 0*rowdata.loc[:,'time'] rowdata[yparam1] = rowdata['y1'] if yparam2 != 'None': try: - rowdata['y2'] = rowdata.ix[:,yparam2] + rowdata['y2'] = rowdata.loc[:,yparam2] rowmin = rowdata[yparam2].min() except KeyError: - rowdata['y2'] = 0*rowdata.ix[:,'time'] + rowdata['y2'] = 0*rowdata.loc[:,'time'] rowdata[yparam2] = rowdata['y2'] else: rowdata['y2'] = rowdata['y1'] @@ -2968,7 +2968,7 @@ def interactive_flex_chart2(id=0,promember=0, if yparam1 == 'pace': y_axis_type = 'datetime' try: - y1mean = rowdata.ix[:,'pace'].mean() + y1mean = rowdata.loc[:,'pace'].mean() except KeyError: y1mean = 0 @@ -3450,26 +3450,26 @@ def thumbnail_flex_chart(rowdata,id=0,promember=0, try: - tseconds = rowdata.ix[:,'time'] + tseconds = rowdata.loc[:,'time'] except KeyError: return '','No time data - cannot make flex plot' try: - rowdata['x1'] = rowdata.ix[:,xparam] + rowdata['x1'] = rowdata.loc[:,xparam] except KeyError: - rowdata['x1'] = 0*rowdata.ix[:,'time'] + rowdata['x1'] = 0*rowdata.loc[:,'time'] try: - rowdata['y1'] = rowdata.ix[:,yparam1] + rowdata['y1'] = rowdata.loc[:,yparam1] except KeyError: - rowdata['y1'] = 0*rowdata.ix[:,'time'] + rowdata['y1'] = 0*rowdata.loc[:,'time'] if yparam2 != 'None': try: - rowdata['y2'] = rowdata.ix[:,yparam2] + rowdata['y2'] = rowdata.loc[:,yparam2] except KeyError: - rowdata['y2'] = 0*rowdata.ix[:,'time'] + rowdata['y2'] = 0*rowdata.loc[:,'time'] else: rowdata['y2'] = rowdata['y1'] @@ -3490,7 +3490,7 @@ def thumbnail_flex_chart(rowdata,id=0,promember=0, if yparam1 == 'pace': y_axis_type = 'datetime' - y1mean = rowdata.ix[:,'pace'].mean() + y1mean = rowdata.loc[:,'pace'].mean() rowdata['xname'] = axlabels[xparam] @@ -3732,9 +3732,9 @@ def interactive_multiple_compare_chart(ids,xparam,yparam,plottype='line', nrworkouts = len(ids) try: - tseconds = datadf.ix[:,'time'] + tseconds = datadf.loc[:,'time'] except KeyError: - tseconds = datadf.ix[:,xparam] + tseconds = datadf.loc[:,xparam] yparamname = axlabels[yparam] @@ -3954,11 +3954,11 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm', rowdata2.sort_values(by='time',ascending=True,inplace=True) try: - x1 = rowdata1.ix[:,xparam] - x2 = rowdata2.ix[:,xparam] + x1 = rowdata1.loc[:,xparam] + x2 = rowdata2.loc[:,xparam] - y1 = rowdata1.ix[:,yparam] - y2 = rowdata2.ix[:,yparam] + y1 = rowdata1.loc[:,yparam] + y2 = rowdata2.loc[:,yparam] except KeyError: return "","No valid Data Available" @@ -3976,21 +3976,21 @@ def interactive_comparison_chart(id1=0,id2=0,xparam='distance',yparam='spm', ymax = 1.0e3*90 ymin = 1.0e3*210 - ftime1 = rowdata1.ix[:,'ftime'] - ftime2 = rowdata2.ix[:,'ftime'] + ftime1 = rowdata1.loc[:,'ftime'] + ftime2 = rowdata2.loc[:,'ftime'] - hr1 = rowdata1.ix[:,'hr'] - hr2 = rowdata2.ix[:,'hr'] + hr1 = rowdata1.loc[:,'hr'] + hr2 = rowdata2.loc[:,'hr'] - fpace1 = rowdata1.ix[:,'fpace'] - fpace2 = rowdata2.ix[:,'fpace'] + fpace1 = rowdata1.loc[:,'fpace'] + fpace2 = rowdata2.loc[:,'fpace'] - distance1 = rowdata1.ix[:,'distance'] - distance2 = rowdata2.ix[:,'distance'] + distance1 = rowdata1.loc[:,'distance'] + distance2 = rowdata2.loc[:,'distance'] - spm1 = rowdata1.ix[:,'spm'] - spm2 = rowdata2.ix[:,'spm'] + spm1 = rowdata1.loc[:,'spm'] + spm2 = rowdata2.loc[:,'spm'] if (promember==1): TOOLS = 'save,pan,box_zoom,wheel_zoom,reset,tap,hover,resize,crosshair' diff --git a/rowsandall_app/urls.py b/rowsandall_app/urls.py index 48d643f4..2d5fd3a6 100644 --- a/rowsandall_app/urls.py +++ b/rowsandall_app/urls.py @@ -80,11 +80,11 @@ urlpatterns += [ if settings.DEBUG: import debug_toolbar + import django urlpatterns += [ url(r'^__debug__/',include(debug_toolbar.urls)), - url( - regex=r'^static/(?P.*)$', - view='django.views.static.serve', + url(r'^static/(?P.*)$', + django.views.static.serve, kwargs={'document_root': settings.STATIC_ROOT,} ) ]