Uses Flask to allow users to follow various cryptocurrency trends. Dash is integrated into the app as a seperate feature to run custom stock analysis and predictions.
This project was started as a collaborative sprint between multiple developers and eventually I forked it to complete it and put a nice bow on it. See original PR history here: https://github.com/PDXPythonPirates/ppp-project-2
Personal Goals:
- Learn the ins and outs of Flask for web app developement
- Containerization using Docker
- Schema design and working with Databases
- Deploying and productionizing an app
- Contiuous Integration
- Extend the app to run stock analysis
Tech Stack Information
- Flask Backend
- Utilized github actions for continuous integration and testing
- Containerized using docker compose
- Javascript and Jinja frontend rendering
- Integrated dash app for quick analysis
- Utilizes CoinGecko API to gather coin data
- Added MySQL database for prod deployment
- pre-commit linting to adhere to black and flake8
- Added unit tests to verify page functionality
Note: You need an .env file with credentials to boot the mysql container locally.
Required environment variables
- DATABASE_URL
- DB_USER
- DB_PASSWORD
- DB_HOST
- DB_NAME
- DB_PORT
- DATABASE_URL_DOCKER
Pre-configuration install Notes for Windows
- Install choclatey as an administrator (from powershell): https://chocolatey.org/install
- Use choco to install make (also from the powershel as admin): `choco install make`
- Install poetry. This can be a pain on Windowns. Use docker containers or another virtual environment.
- Use WSL to execute make commands on windows. Alternatively, you can run the commands in the make file one by one.
-
- run
make up
- Runs the docker containers locally and opens on http://localhost:5000 (this also boots a mysql container)
- run
make down
- Stops containers and prunes
- run
-
- run
make install
- Installs dependencies and jump into the virtual env
- run
flask run
- Boots the app locally. Make sure you are in the top level directory that has the file "app_run.py"
- run
- Install Docker by following the instructions on their site
- run
make stop
to stop containers and prune
- Install a new dep/library run
poetry add <your_dep>
orpoetry add <dep> --dev
- Resolve poetry.lock files. Use 1. to resolve on github or 2. to resolve locally (recommended)
- On github click on resolve conflicts and follow this guide
- Locally, pull the recent changes. Remove the lock file with the conflict
rm poetry.lock
. runmake install
to regenerate the lock file. Push changes and give yourself a high five!
- Note: make sure poetry is installed and first time setup is complete
- Take a look at the Makefile to see what shell commands are being executed
make install
- we use poetry to track python deps
- to install a new dep run
poetry add <your_dep>
orpoetry add <dep> --dev
- you can also modify the pyproject.toml directly, then run
poetry lock --no-update
- Install brew
- Install pyenv
brew install pyenv echo 'eval "$(pyenv init --path)"' >> ~/.zprofile echo 'eval "$(pyenv init -)"' >> ~/.zshrc
- Install zsh
brew install zsh
- Install Python 3.8.10
pyenv install 3.8.10
Help with various installation/setup issues:
- Mac https://github.com/culturerobotics/universe/blob/fbc0dd1da6ad3ea3da11001d0a9adfdddc7630a9/vessel/cookbook/cora075_scalable_process_5L.py#L320
- Error port 5000 already in use. How to free up this port: system preferences > sharing > uncheck airplay receiver.
- Testing Markdown - dillinger.io