Skip to content

File Upload using Flask - demo - work-in-progress

Notifications You must be signed in to change notification settings

wmelvin/flask-file-up

Repository files navigation

File Upload App using Flask

This is a work-in-progress demo. If it works out, a LICENSE will be added when it is done. Otherwise this repository will probably go away.

Created: 2022-10-18

Links

Flask Documentation

Modular Applications with Blueprints

Use flask.current_app to access app.config values in view modules using blueprints. Only available in the Request Context.


SQLAlchemy


flask-sqlalchemy - PyPI

Flask-SQLAlchemy Documentation

flask-sqlalchemy - GitHub

Flask-Migrate - PyPI

miguelgrinberg/Flask-Migrate - GitHub - SQLAlchemy database migrations for Flask applications using Alembic.

alembic - PyPI

Alembic documentation


Flask-WTF - Documentation Flask-WTF - PyPI

WTForms - Documentation


Flask-Login - Documentation

Flask-Login - PyPI

maxcountryman/flask-login - GitHub - Flask user session management.


Werkzeug Documentation:


SQLAlchemy 1.4 Documentation: Microsoft SQL Server

pyodbc - PyPI

Install the Microsoft ODBC driver for SQL Server (Linux) - ODBC Driver for SQL Server - Microsoft Learn

The first part of the instructions at the above Microsoft Learn link could be skipped because, in the host used for development, the Microsoft sources are already in /etc/apt/sources.list.d/ from previously installing other MS tooling. Confirmed that by searching:

    apt-cache search msodbcsql
msodbcsql17 - ODBC Driver for Microsoft(R) SQL Server(R)
msodbcsql18 - ODBC Driver for Microsoft(R) SQL Server(R)

Installed the ODBC Driver 18 for SQL Server version:

    sudo apt install msodbcsql18

Note: The Linux containers used to host Azure Webapps have msodbcsql18 installed.


Quickstart: Deploy a Python (Django or Flask) web app to Azure - Microsoft Learn

az webapp deploy - Microsoft Learn


AzureAD/microsoft-authentication-library-for-python - GitHub

Microsoft Authentication Library (MSAL) for Python makes it easy to authenticate to Azure Active Directory. These documented APIs are stable https://msal-python.readthedocs.io. If you have questions but do not have a github account, ask your questions on Stackoverflow with tag "msal" + "python".

Wiki: AzureAD/microsoft-authentication-library-for-python - GitHub

Microsoft identity platform overview - Microsoft Entra - Microsoft Learn

Flask-Session - PyPI

Quickstart: Sign in users in web apps using the auth code flow - Microsoft Entra - Microsoft Learn

Notes

Using Visual Studio Code with the cornflakes-linter and Better Jinja extensions.

Added settings to the .vscode/settings.json file for the project (not in repo). The python.formatting.blackArgs setting in this fragment overrides some of the black formatter's defaults:

"python.formatting.provider": "black",
"python.formatting.blackArgs": [
    "--skip-string-normalization",
    "--line-length",
    "79"
],

I ended up removing the --skip-string-normalization setting. Even though I would prefer to use single quotes in most cases, because I have been using black in other projects, I am now in the habit of using double quotes, but not always. Therefore, I'll just let them be normalized for consistency. -wem

This fragment tells Better Jinja to treat HTML files as Jinja2 templates:

"files.associations": {
    "*.html": "jinja-html"
}

Using pip-compile, part of pip-tools, to create/update requirements.txt from requirements.in.

GitHub: jazzband/pip-tools: A set of tools to keep your pinned Python dependencies fresh.