Skip to content

wjohnson/flask_template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A Quick Template for Flask Apps

This is my personal template for creating flask applications that require user authentication. It draws heavily from Miguel Greenberg's incredible Flask Mega Tutorial and uses Bootstrap.js for a nice responsive design.

This template is available for you to use, but comes with no guarantee or warranty. Use at your own risk.

Getting up and Running

virtualenv env
source ./env/bin/activate
pip install -r requirements.txt
export FLASK_APP=apprunner.py
flask db init
flask db migrate -m "Initial database build"
flask db upgrade
flask run

Deploying to Azure

  • Follow these deploy to Azure for Python instructions through your first push to Azure.

    • Create an App Service Plan, Service, and Resource Group to hold the services.
    • Create a deployment user.
    • Add azure as a remote repository.
  • Configure the App Service for Python

    • Add the Python 3.6 extension.
    • Ensure that the web.config file reflects the location of your installed extension.
    • On the kudu console, cd into the folder containing the python installed by the extension.
    • python -m pip install -r requirements.txt while in that folder.
  • OPTIONAL: Create an Azure SQL DB Server and Database

    • Quick Start

    • Create an application user and grant them permissions.

      --On master CREATE LOGIN some_application_user WITH PASSWORD = 'SomeSecurePassword'

      --On your application db CREATE USER some_application_user FOR LOGIN some_application_user WITH DEFAULT_SCHEMA = dbo GO

      -- Add user to the database owner role EXEC sp_addrolemember N'db_datareader', N'some_application_user' GO EXEC sp_addrolemember N'db_datawriter', N'some_application_user' GO

  • MISCELLANEOUS Checklist

    • Add the environment variables to web.config.
    • Create any additional folders on the kudu console.

Working with VS Code and Flask Apps

  • Setting an environment variable.
    • Powershell: $env:MyVariable=SomeValue
    • CMD: set MyVariable=SomeValue
    • Linux: export MyVariable=SomeValue
  • Viewing an environment variable
    • Powershell: Get-ChildItem Env:MyVariable
    • CMD: echo %MyVariable%
    • Linux: echo $MyVariable

About

A Flask website template for quickly making a website

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published