Python Forum
[Flask]Bootstrap node npm gulp bower
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Flask]Bootstrap node npm gulp bower
#2
Make this web based virtual environment on Linux and run a BootStrap template in Flask.
Using Linux Mint 18.1 Serena,with default Python 3.5.

OS install:
sudo apt-get install python3-pip
sudo pip3 install virtualenv
Virtual environment with FlasknpmgulpbowerYeoman:
# Make virtual enviroment
mint@mint ~ $ virtualenv -p /usr/bin/python3.5 new_age
mint@mint ~ $ cd new_age
# Activate
mint@mint ~/new_age $ source bin/activate

# Check enviroment
(new_age) mint@mint ~/new_age $ which python
/home/mint/new_age/bin/python
(new_age) mint@mint ~/new_age $ pip -V
pip 9.0.1 from /home/mint/new_age/lib/python3.5/site-packages (python 3.5)

# Install Flask
(new_age) mint@mint ~/new_age $ pip install flask

# nodeenv
(new_age) mint@mint ~/new_age $ pip install nodeenv
(new_age) mint@mint ~/new_age $ nodeenv -p

# Version
(new_age) mint@mint ~/new_age $ node -v
v7.8.0
(new_age) mint@mint ~/new_age $ npm -v
4.2.0

# install web tool
(new_age) mint@mint ~/new_age $ npm install -g yo gulp-cli bower
(new_age) mint@mint ~/new_age $ npm install --save-dev gulp
(new_age) mint@mint ~/new_age $ npm init

# Versions
(new_age) mint@mint ~/new_age $ gulp -v
[20:12:37] CLI version 1.2.2
[20:12:37] Local version 3.9.1
(new_age) mint@mint ~/new_age $ bower -v
1.8.0

Choosing an other template New Age:
Folder setup:
newage\
  -- app.py
  tempaltes\
  -- index_flask.html
  static\
    \all folder from bower download
I made script to change index.html to index_flask.html
It link all CSS,JS and images to flask static folder.
Download:
(new_age) mint@mint ~/new_age $ bower install https://github.com/BlackrockDigital/startbootstrap-new-age.git
In startbootstrap-new-age folder:
Run index_changer.py copy index_flask.html and all folders to static folder.
# app.py
from flask import Flask, render_template, jsonify, request
 
app = Flask(__name__)
 
@app.route('/')
def hello():
    return render_template("index_flask.html")
 
if __name__ == '__main__':
    app.run(debug=True)
Run it using Flask build in web-server:
python app.py in browser 127.0.0.1:5000
If work should look like Live Preview
Reply


Messages In This Thread
[Flask]Bootstrap node npm gulp bower - by snippsat - Apr-08-2017, 11:25 PM
RE: [Flask]Bootstrap node npm gulp bower - by snippsat - Apr-11-2017, 01:56 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020