A basic template for building minimal web applications.
InsightFL is a basic Flask template created specifically to help budding data scientists in the Insight Data Science program. It comes with a very basic Bootstrap template to help Insight fellows get started building their web application. If you are new to Flask and/or web development, take a look at the resources below.
To get started building your web app, follow the instructions below to setup your development environment.
Note: This assumes you are comfortable with the Terminal and have some familiarity with Unix/Linux commands. If this is not the case, take a look at this guide.
- Fork the project and clone the repository.
Note: It is helpful to change the repository name before cloning. In Github, click on Settings
on the right-hand
side of your screen. Within the Settings box at the top of the screen, rename the repository and click Rename
.
git clone git@github.com:<username>/<project>.git
- Recommended: Install virtualenv and fire up a virtual environment.
# cd into your InsightFL project folder
# Install virtualenv
sudo pip install virtualenv
# Create virtualenv folder `venv`
virtualenv venv
# Activate the virtual environment
source venv/bin/activate
- Install Python project dependencies.
pip install -r requirements.txt
- To test your application, run the manage.py file:
python manage.py runserver
, and open your web browser tolocalhost:5000
.
That's it! You are ready to start building your web application.
Note: manage.py
uses the builtin server for development. You should not use the builtin development server
in production (i.e. when you're launching your web application). To run in production, use gunicorn manage:app
at
the command line.
InsightFL's project layout mimics that of large Flask applications. This is done intentionally. Despite the fact that most Insight projects are small applications, utilizing this structure allows you to separate your development concerns more effectively. Instead of having all your web app code in one file, it can be broken up into separate, smaller chunks, which makes for cleaner code and easier debugging.
- app - Where your Flask web application lives. This is where you'll spend the majority of your time
- .gitignore - Git ignore file
- config.py - Project configuration file for storing sensitive or dynamic settings, e.g. database settings
- LICENSE.md - Project license
- manage.py - Entry point to your Flask application during development, click here for more info.
- README.md - You're looking at it! :)
- requirements.txt - Tracks all your Python dependencies using pip
- schema.sql - Your SQL database schemas
-
Documentation
-
Interactive Tutorials
-
Books