Kaili Wang 5a33bfbf48 fix anon score (#67) | před 2 roky | |
---|---|---|
.. | ||
app | před 2 roky | |
db_utils | před 2 roky | |
tests | před 2 roky | |
README.md | před 2 roky | |
__init__.py | před 3 roky | |
config.py | před 3 roky | |
dump.rdb | před 3 roky | |
init_env.sh | před 3 roky | |
requirements.txt | před 2 roky | |
run.py | před 3 roky |
Before you run the project locally, follow the installation steps below.
After that, do the following:
sh start_redis.sh (start the redis server)
cd webapp
python run.py (run the actual app)
Note: if it throws an error about ens
not being found, do NOT install ens
. install/reinstall web3
(pip install web3
).
If it throws other import errors, then just pip install {package-name}
You will need to run for every fresh terminal instance
export FLASK_APP=run.py
export INFURA_ALPHA_ID='your-infura-alpha-id'
export INFURA_ALPHA_SECRET='your-infura-alpha-secret'
source init_env.sh
If you get issues later about webapp.run not being found, then replace run.py
with the absolute path of webapp/run.py
Note that you will need to do this even if you did this in the parent directory.
create a venv using python -m venv ./path/to/where/you/want/your/venv
then: source ./{path-to-venv}/bin/activate
then
cd webapp
pip -r install requirements.txt
Redis installations
sudo apt install redis-server
sudo apt install redis-cli
sudo apt install redis-tools
Flask db setup:
flask db init
flask db migrate
flask db upgrade
to update the database (if more / fewer tables exist)
cd webapp/app
rm -rf migrations/
psql -U tornado (open psql cli)
\c tornado; (connect to the tornado database)
\dt; (to see current tables)
drop table {name of table} (to delete table so that you can repopulate later)
\q (quit)
flask db init
flask db migrate
flask db upgrade
If you made backend changes that change the api response, you'll need to flush redis.
redis-cli -h localhost -p 6380
^ make sure redis-server is running in another terminal tab simultaneously.
cd webapp/app/static
npm run watch
now, whenever you change and save your code, it will automatically update the running front-end code.