Isomorphic React, served by Python, running on Heroku.
Uses the excellent python-react library by @markfinger and heroku-buildpack-runit buildpack by @dpiddy.
See a live demo of this code at https://heroku-python-react.herokuapp.com.
First install local Python and Node dependencies:
mkvirtualenv heroku-python-react
pip install -r requirements.txt
npm install
First create your new app using the heroku
command-line tool.
heroku create
This creates a new Heroku app named something like your-app-12345
.
Then set up the three buildpacks needed to deploy the app:
heroku buildpacks:add https://github.com/dpiddy/heroku-buildpack-runit.git
heroku buildpacks:add heroku/python
heroku buildpacks:add heroku/nodejs
Finally, deploy:
git push heroku master
Open your browser to your new app at, e.g., https://your-app-12345.herokuapp.com
First start a local webpack server to compile server-side assets:
npm run dev
Then, in another tab, start a local Heroku process:
heroku local -f Procfile.web
Open your browser to http://localhost:5000
to see the running app.