run webpack-dev-server and flask server with concurrently

master
Will Roberts 8 years ago
parent f1e89d809f
commit b278a72015
  1. 23
      {{cookiecutter.app_name}}/README.rst
  2. 3
      {{cookiecutter.app_name}}/package.json

@ -15,30 +15,29 @@ add the following to ``.bashrc`` or ``.bash_profile``.
export {{cookiecutter.app_name | upper}}_SECRET='something-really-secret'
Before running shell commands, set the ``FLASK_APP`` and ``FLASK_DEBUG``
environment variables ::
export FLASK_APP=/path/to/autoapp.py
export FLASK_DEBUG=1
Then run the following commands to bootstrap your environment ::
Run the following commands to bootstrap your environment ::
git clone https://github.com/{{cookiecutter.github_username}}/{{cookiecutter.app_name}}
cd {{cookiecutter.app_name}}
pip install -r requirements/dev.txt
npm install
npm start # run the webpack dev server
flask run # run the flask server
npm start # run the webpack dev server and flask server using concurrently
You will see a pretty welcome screen.
In general, before running shell commands, set the ``FLASK_APP`` and
``FLASK_DEBUG`` environment variables ::
export FLASK_APP=/path/to/autoapp.py
export FLASK_DEBUG=1
Once you have installed your DBMS, run the following to create your app's
database tables and perform the initial migration ::
flask db init
flask db migrate
flask db upgrade
flask run
npm start
Deployment
@ -47,8 +46,8 @@ Deployment
To deploy::
export FLASK_DEBUG=0
npm run build
flask run
npm run build # build assets with webpack
flask run # start the flask server
In your production environment, make sure the ``FLASK_DEBUG`` environment
variable is unset or is set to ``0``, so that ``ProdConfig`` is used.

@ -8,8 +8,8 @@
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "./node_modules/.bin/webpack-dev-server --port 2992 --hot --inline",
"build": "NODE_ENV=production ./node_modules/.bin/webpack --progress --colors -p",
"start": "NODE_ENV=debug FLASK_APP=$PWD/autoapp.py FLASK_DEBUG=1 ./node_modules/.bin/concurrently \"./node_modules/.bin/webpack-dev-server --port 2992 --hot --inline\" \"flask run\"",
"lint": "eslint \"assets/js/*.js\""
},
"repository": {
@ -32,6 +32,7 @@
"babel-eslint": "^7.2.3",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.24.1",
"concurrently": "^3.5.0",
"css-loader": "^0.28.4",
"eslint": "^3.19.0",
"eslint-config-airbnb-base": "^11.2.0",

Loading…
Cancel
Save