mikebell.xyz


If you need a Computer Science tutor, code reviewer, or someone to pair program with, click here


Creating a new Flask project with pipenv

$ mkdir project
$ cd project
$ pipenv install

$ pipenv install flask

mkdir app
touch app/__init__.py
touch app/routes.py
touch microblog.py

from flask import Flask

app = Flask(__name__)

from app import routes

from app import app

@app.route('/')
@app.route('/index')
def index():
    return "Hello, World!"

from app import app

$ pipenv shell

$ export FLASK_APP=microblog.py

$ flask run

Now, whenever you need to extend your Flask app to import some new libraries or framework or whatever, just install it using pipenv.


This whole process inspired me to write a bash script that does all this automatically for you. Why make things harder than they need to be?

Grab autoflask.sh and give it a spin on your system to quickly get a barebones Hello World project in Flask started today!


If you need a Computer Science tutor, code reviewer, or just someone to pair program with, hit me up