A quick and easy Python + Flask + React template project, using Twitter Bootstrap 5.0 and React Router for creating a simple single page application.
- Clone repository.
- Open a command prompt, navigate to the folder, and enter:
npm install
- Next, run a build of the React client by entering:
npm run dev
You can make changes to the pages in /src/components
and see them update live.
http://pythonbootstrapper.herokuapp.com
- /src/index.js
- /src/App.js
- /src/components/Header/index.js
- /src/components/Footer/index.js
- /src/components/Home/index.js
- /src/components/About/index.js
- /src/components/Contact/index.js
- /src/components/NotFound/index.js
Edit /src/components/Home/index.js
to add your content to the Home page. The default contents include:
class Home extends Component {
render() {
return (
<h1>Home</h1>
<div>{this.state.time}</div>
)
}
}
After creating the application on Heroku, click Settings, under Buildpacks, add heroku/nodejs and heroku/python.
This will allow Heroku to build the react static files and serve the Python Flask app.
Kory Becker http://www.primaryobjects.com/kory-becker