Repository for the AfricanSWIFT Project Management Tool (swift-pm). A web app that hosts an editable database for the project Management of African SWIFT.
See wiki for user guide.
Individual python modules are managed in the pip lock file and installed as per installation instructions
- pip3 >= 18.0
- pipenv
- autoenv
- python3
- python-libs
- Flaskr
- postgresql-10.4
pipenv install --three
- there after
pipenv shell
or
conda env create -f swift.yaml
conda activate swift
and thereafter to use
first use
initdb -D ~/postgresql_data/
postgres -D ~/postgresql_data/ &
- assign:
export APP_SETTINGS='config.DevelopmentConfig'
export SECRET_KEY='key'
export ADMIN_PWD='chosen password'
export DATABASE_URL="postgresql://localhost/DBname"
- create database
createdb DBname
- populate with
python populatePSQL.py
python manage.py db upgrade
- run on localhost
python manage.py runserver
thereafter
pipenv shell
orconda activate swift
postgres -D ~/postgresql_data/ &
- assign:
export APP_SETTINGS='config.DevelopmentConfig'
export SECRET_KEY='key'
export ADMIN_PWD='chosen password'
export DATABASE_URL="postgresql://localhost/DBname"
- run on localhost
python manage.py runserver
This app is currently hosted on herokuapp.
For example push changes and launch the app:
heroku login
git config heroku.remote heroku
git add -A
git commit -a -m'commit messgae'
git push heroku master
heroku run -a swift-pm python manage.py db upgrade
or to populate the database:
heroku config:set DATABASE_URL="postgresql://localhost/DBNAME"
heroku run -a swift-pm python populatePSQL.py
For the SWIFT-pm app backups are scheduled daily at 00:00 (GMT) via
heroku pg:backups:schedule --at '00:00 Europe/London' --app <app name>
These are retained for 7 days with one weekly backup stored for one week.
To obtain a local copy to merge or manipulate or put to MS Access:
createdb myapp_devel # start with an empty database
heroku run 'pg_dump -xO $DATABASE_URL' --app <app name> | psql myapp_devel
- Run script dumpPSQL.sh ($ bash dumpPSQL.sh) to dump data from the postgresql database tables into csv files
- Make a copy of the MS Access database file: $ cp SWIFTDB_template.accdb SWIFTDB.accdb
- Fire up Windows using rdesktop (on foe-linux) and open MS Access and open the file SWIFTDB.accdb
- Click 'External Data -> Saved Imports' from the ribbon and click 'Run' on each of the items in the Saved Imports list in turn. You may have to alter the paths to your csv files.
- Save the database file, which should now include populated tables
# Create a public url
heroku pg:backups:url --app sushi | cat
# Download latest dump
heroku pg:backups:download
Information on the web page template.
The web app is built using python flask and thus the html file must adhere to the flask formatting rules. Each page builds on layout.html.
The styling for this webpage uses BOOTSTRAP
To customise the bootstrap css a text css file is loaded in after the bootstrap library static/styles/stylesheet.css
- Navbar
- An additional div container is added to the nav bar in order to allow interaction with a text/css
- stylesheet.css then contains an update to navbar-default
- Tables
- For admin the tables are very long added scrolling with sticky headers
The following javascript libraries are loaded:
- jquery
- bootstrap javascript
- A script is added to view.html to add in a select all check checkbox
- A script has been added to redirect to https
Here the custom style sheets and logos must be changed. If this system is to be used on another site the SWIFTlogo would need to be swapped and the colour coding (hex codes) in style sheet altered.