Skip to content

tsadimas/flask-example-project

Repository files navigation

how to run this project

  • clone
git clone https://github.com/tsadimas/flask-example-project.git
  • create virtual environment, activate and install requirements
python3 -m venv fvenv
source fvenv/bin/activate
pip install -r requirements.txt
  • run
python app/main.py

or

export FLASK_APP=app.main.py FLASK_DEBUG=1 TEMPLATES_AUTO_RELOAD=1; flask run -h 0.0.0.0 -p 8000

or

gunicorn app.main:app  --bind 0.0.0.0:5000

Database env variables (sqlite, postgres, mysql)

SQLALCHEMY_DATABASE_URI=sqlite:///./students.sqlite3
SQLALCHEMY_DATABASE_URI=postgresql://demouser:[email protected]/demodb
SQLALCHEMY_DATABASE_URI: mysql://demo:demo@db01/demo

env variables

  • copy .env.example
cp .env.example .env

define the variables

SQLALCHEMY_DATABASE_URI

Docker

docker build -t myflask .

run

docker run --env-file .env -p 5000:5000 myflask

Docker-compose

docker-compose up --build

install packages for mysql

in order to install mysqlclient dependency, install the corresponding libpython-dev, e,g,

sudo apt install libmysqlclient-dev
sudo apt install libpython3.10-dev

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published