Run on server, update dependencies

This commit is contained in:
2019-08-23 04:08:15 -04:00
parent 1d9583489f
commit 96b7a4a98c
13 changed files with 82 additions and 69 deletions

2
scripts/create_user.sql Normal file
View File

@@ -0,0 +1,2 @@
DROP ROLE IF EXISTS spotifyvis_user;
CREATE ROLE spotifyvis_user LOGIN PASSWORD 'spotifyvis_user';

View File

@@ -1,5 +1,6 @@
-- select t.name as track, a.name as artist
select timestamp, substring(t.name for 50) as track, a.name as artist
select distinct on (1)
timestamp, substring(t.name for 50) as track, a.name as artist
from api_history as h
join api_track as t
on h.track_id = t.id
@@ -7,5 +8,6 @@ join api_track_artists ta
on ta.track_id = t.id
join api_artist a
on a.id = ta.artist_id
-- limit 10;
;
order by timestamp desc
-- ;
limit 20;

View File

@@ -1,40 +0,0 @@
astroid==2.2.5
backports.csv==1.0.7
certifi==2019.3.9
chardet==3.0.4
defusedxml==0.5.0
Django==2.2
django-appconf==1.0.3
django-compressor==2.2
django-crispy-forms==1.7.2
django-filter==2.1.0
django-sass-processor==0.7.3
django-tables2==2.0.6
djangorestframework==3.9.2
et-xmlfile==1.0.1
idna==2.8
isort==4.3.17
jdcal==1.4
lazy-object-proxy==1.3.1
libsass==0.18.0
mccabe==0.6.1
odfpy==1.4.0
openpyxl==2.6.2
psycopg2==2.8.2
psycopg2-binary==2.8.2
pylint==2.3.1
python-dateutil==2.8.0
pytz==2019.1
PyYAML==5.1
rcssmin==1.0.6
requests==2.21.0
rjsmin==1.1.0
six==1.12.0
sqlparse==0.3.0
tablib==0.13.0
typed-ast==1.3.1
unicodecsv==0.14.1
urllib3==1.24.1
wrapt==1.11.1
xlrd==1.2.0
xlwt==1.3.0

View File

@@ -1,15 +1,16 @@
#!/bin/bash
# check if in virtual environment
# https://stackoverflow.com/questions/15454174/how-can-a-shell-function-know-if-it-is-running-within-a-virtualenv/15454916
# python -c 'import sys; print(sys.real_prefix)' 2>/dev/null && INVENV=1 || INVENV=0
# INVENV=$(python -c 'import sys; print ("1" if hasattr(sys, "real_prefix") else "0")')
# https://stackoverflow.com/a/15454284/8811872
[[ "$VIRTUAL_ENV" == "" ]]; INVENV=$?
# if $INVENV is 1, then in virtualenv
# echo $INVENV
# if [ $INVENV -eq 1 ]; then
if [ $INVENV -eq 1 ]; then
rm login/migrations/0* api/migrations/0*
sudo -u postgres psql -f reset_db.sql
python manage.py makemigrations login api
python manage.py migrate --fake
python manage.py runserver
# fi
sudo -u postgres psql -f ./scripts/reset_db.sql
python3 manage.py makemigrations login api
python3 manage.py migrate --fake
python3 manage.py runserver
fi

View File

@@ -1,3 +1,3 @@
DROP DATABASE spotifyvis;
DROP DATABASE IF EXISTS spotifyvis;
CREATE DATABASE spotifyvis;
GRANT ALL PRIVILEGES ON DATABASE spotifyvis TO django;
GRANT ALL PRIVILEGES ON DATABASE spotifyvis TO spotifyvis_user;