Newcomers, see the intro doc to get an idea of what this project is about.
- Google Drive Assets - https://drive.google.com/open?id=1ZpnoNeRRa7MEpIqcvVNDGo1WPLLD7oBR
This project:
- has a React JS web app front-end,
- uses Flask and
flask_restfulfor the backend APIs, - uses PostGreSQL for data persistence
- Heroku as the app cloud platform
- and various Python packages for the background workers
cd frontend- Install the front-end dependencies by running
npm install. - Run the project with:
npm start- Runs a development server with hot reloadingnpm run build- Creates a/distfolder containing a minified bundle (bundle.js) andindex.htmlnpm run serve- Serves the/distfolder on an express server
- Back-end Python dependencies are managed by
pipenv. Dopipenv install --devto install everything. - Install PostGreSQL for local development.
- You need to run
export DATABASE_URL=postgresql://localhost/$(whoami) && export FLASK_APP=./app.py(for Windows usesetnotexport) Run(probably don't want to do this)flask db init
cd messenger-bot- Install with
yarnby runningyarn.
coming soon
To deploy the web app, you'll need Heroku set up.
- Get the Heroku CLI if you don't already have it.
- You will need to get added as a collaborator to the app.
The web application is deployed automatically on push to master
cd messenger-bot- (FIRST TIME ONLY)
now switch source-rank yarn run deploy- Check
sourcerank-fb-messenger-bot.now.sh(latest deployment)
coming soon
For our Heroku provided 'review apps' the DB isn't automatically created. A command of this form can be manually run after the review app is create to copy over data
heroku pg:copy facebook-hack-2018::DATABASE_URL DATABASE_URL --app facebook-hack-2018-pr-1384 --confirm facebook-hack-2018-pr-1384
python app.py
-
cd frontend/ -
yarn run start
yarn run start
coming soon
Database schema migrations are performed by editing the FlaskSQLAlchemy models in backend/models.py and then using Flask-Migrate to migrate with the command flask db migrate.
After running that command, check the created migration file in migrations/. If it looks good, run flask db upgrade to apply the migration and then commit the new migration file to the repo.