Skip to content

mrgnr/flask-vanilla-demo

Repository files navigation

Flask-Vanilla Demo

This is a demo website that uses Flask to serve pages styled with Vanilla Framework. I worked on this while learning Vanilla and going through the Flask Framework Cookbook.

What it implements

Project setup and running

Copy .env to .env.local and modify it with your configuration settings:

export SECRET_KEY=YourSecretKey
export FLASK_ENV=development
export GITHUB_OAUTH_CLIENT_ID=YourGithubOauthClienId
export GITHUB_OAUTH_CLIENT_SECRET=YourGithubOauthClientSecret

To allow user authentication via GitHub, create an OAuth app on GitHub and use the client ID and secret to set GITHUB_OAUTH_CLIENT_ID and GITHUB_OAUTH_CLIENT_SECRET.

Create a virtual environment and install requirements:

$ virtualenv venv
$ source venv/bin/activate
$ pip install -r requirements.txt

Run the server:

$ source .env.local
$ flask run --cert=adhoc

You should be able to access the site at https://localhost:5000.

Note: OAuth2 integration with GitHub requires HTTPS to work, so the above command uses the --cert=adhoc option to generate self-signed certificates for development. You can leave this option off and access the site over plain HTTP if you don't care about using GitHub for user authentication.

Deployment

Heroku

Click the button below to deploy to Heroku:

Deploy to Heroku