Skip to content

DISARMFoundation/DISARMexplorer

Repository files navigation

DISARM Explorer code

Code for an online viewer of the DISARM frameworks and datasets.

Written in Python, Flask, D3.

How to make this run

Running locally

Getting set up to run the code:

  • Install postgresql locally You can get postgresql from https://www.postgresql.org/
  • Create a DISARM database. Use postgresql to create a database called "disarmsite".
  • Populate the DISARM database. The Jupyter file generate_disarm_pages.ipynb in the DISARM Frameworks repository will do this for you - you'll need to install Anaconda or another Jupyter package first. NB if you don't want to run Jupyter, you can run the python file generate_disarm_sql.py to do the same thing.
  • Get a local copy of this repository. Open a terminal window. git clone this repository. cd into it
  • Create a virtual environment. From the top folder of this repo, type "virtualenv venv" in the terminal window. See this for more details.

Updating the code:

  • Edit the code. The html updates will show immediately. You might have to clear your browser caches to show any javascript changes though.

Running the code:

  • . venv/bin/activate;
  • export FLASK_APP=disarmsite; export FLASK_ENV=development; export DATABASE_URL2="postgresql:///disarmsite"
  • flask run

These instructions: start your virtual environment, points the app at the database you just created, and start the app. You can now go to http://127.0.0.1:5000/ in your browser, and interact with it.

Running on Heroku

Getting set up to run on Heroku:

Updating Heroku code and database:

  • pg_dump -Fc -h localhost -U <yourdatabaseusername> disarmsite > disarmsite.dump
  • heroku pg:reset -a <your heroku app name>
  • heroku pg:push disarmsite DATABASE_URL -a <your heroku app name>
  • git add .; git commit -m "heroku stuff"; git push heroku main

These instructions: take a copy of your local postgresql database and put it into file disarmsite.dump. Hard-resets the Heroku app. Pushes the data from disarmsite.dump to the Heroku app. Pushes the code from the current repository into the Heroku app. It's brutal, but whilst the database and app are changing a lot, it's what we do.

Running on Heroku:

Code notes

Database notes:

Planned capabilities:

About

Flask/Python/D3 site for exploring DISARM objects

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published