Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mattfinnell/flask-webpack-cookiecutter
Auto builds the foundation for a minimal Flask+Webpack application
https://github.com/mattfinnell/flask-webpack-cookiecutter
flask node python webpack
Last synced: about 2 months ago
JSON representation
Auto builds the foundation for a minimal Flask+Webpack application
- Host: GitHub
- URL: https://github.com/mattfinnell/flask-webpack-cookiecutter
- Owner: mattfinnell
- License: mit
- Created: 2017-10-21T23:25:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-10T06:40:06.000Z (about 7 years ago)
- Last Synced: 2024-08-08T23:23:37.126Z (5 months ago)
- Topics: flask, node, python, webpack
- Language: Python
- Homepage:
- Size: 62.5 KB
- Stars: 68
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- jimsghstars - mattfinnell/flask-webpack-cookiecutter - Auto builds the foundation for a minimal Flask+Webpack application (Python)
README
# flask-webpack cookiecutter
![Imgur](https://i.imgur.com/MqM2KLG.png)
Builds the skeleton of a flask+webpack app.
- automatically constructs application skeleton
- automatically builds python-flask dependencies
- automatically builds node-webpack dependencies
- automatically sets up a fresh virtualenv environment
- automatically sets up a fresh git repositoryJust run the following 4 commands and then open a browser to `localhost:5000`, simple as that!
```
git clone https://github.com/mattfinnell/flask-webpack-cookiecuttercd
source setup.sh
python wsgi.py
```Was immediately featured as an *Interesting Project* in the [Python Weekly Newsletter!](http://mailchi.mp/pythonweekly/python-weekly-issue-318?e=99f5ef4e2f).
## Installation
```
git clone https://github.com/mattfinnell/flask-webpack-cookiecuttercd
source setup.sh
```This project assumes that you have the following usual suspects already installed
- [`git`](https://git-scm.com/) (...given)
- A python environment with [`python3`](https://docs.python.org/3/whatsnew/3.6.html), [`pip`](https://pip.pypa.io/en/stable/), and [`autoenv`](https://github.com/kennethreitz/autoenv).
- A node environment with the [`node`](https://nodejs.org/en/) runtime and [`yarn`](https://yarnpkg.com/en/).Everything else *literally* builds from there.
## Running
```
# Start webpack-dev-server
yarn start# Start python flask server
python3 wsgi.py
```## Dev vs Production Configurations
Environments can easily be changing between by these environment variables.
The build tool defaults to `DevelopmentConfig`.```
# .env possiblitiesexport FLASK_APP_CONFIG="config.DevelopmentConfig" # DEFAULT
export FLASK_APP_CONFIG="config.TestingConfig"
export FLASK_APP_CONFIG="config.StagingConfig"
export FLASK_APP_CONFIG="config.ProductionConfig"
```### Development
Run `yarn start` and `python3 wsgi.py` as separate processes for they are both servers.
- **Webpack-dev-server** will *serve* files at `localhost:8080/static/build`
- **Flask** will run at `localhost:5000`
- Flask will *request* for css, js, and other assets at `localhost:8080/static/build`### Non-Development
Set `FLASK_APP_CONFIG` to anything other than `config.DevelopmentConfig` then run `yarn build` (instead of start) and `python3 wsgi.py`.
- **Webpack** will build and place all files into `/website/static/build/`.
- **Flask** will run at `localhost:5000`
- Flask will *serve* css, js and other assets from `localhost:5000/static/build`## Node scripts
Run webpack-dev-server
```
yarn start
```Run a webpack production build
```
yarn build
```Continuously run production builds for *exp*erimentation, used for fine tuning `webpack.prod.js`
```
yarn exp
```## Todo
- Fix the `FLASK_APP_CONFIG` issue.
- Add celery into the mix
- Create a better opening page