diff options
author | Marjukka Jämbäck <mjamback@local> | 2023-11-21 11:16:17 +0200 |
---|---|---|
committer | Marjukka Jämbäck <mjamback@local> | 2023-11-21 11:16:17 +0200 |
commit | 2ebfcf29c84b84999b76ff13150ba5a13fd3cac1 (patch) | |
tree | 12fcf0504e9682b279cbadd724f026d6cba01b6e | |
parent | d13d4860f3d5b51d659379aa8a38742bfe49bf37 (diff) |
Make it poetry project and udate install instructions
-rw-r--r-- | README.md | 14 | ||||
-rw-r--r-- | app.py | 2 | ||||
-rw-r--r-- | pyproject.toml | 20 |
3 files changed, 31 insertions, 5 deletions
@@ -2,11 +2,17 @@ Kyselmä - kysele, vastaile ja tutki tuloksia TO GET IT RUNNING: -- Install flask, psycopg, postresql, sqlalchemy (as in course material) + Install postgresql for local user & get it running +- $ wget https://github.com/hy-tsoha/local-pg/raw/master/pg-install.sh +- $ bash pg-install.sh +- $ postrgres & + Clone the source, get tables ready & install poetry dependencies - $ git clone https://github.com/triionhe/kyselma.git -- $ psql -U postgres < SCHEMA.sql (Be careful with '-U postgres' or edit app.py!) -- $ SECRET_KEY=923987295 flask run - +- $ cd kyselma +- $ psql < SCHEMA.sql +- $ poetry install + Start the app in poetry virtual environment +- $ SQLALCHEMY_DATABASE_URI="postgresql:///$USER" SECRET_KEY=923987295 poetry run flask run DONE: - Voi lisätä kyselyn @@ -4,7 +4,7 @@ from db_actions import db app = Flask(__name__, static_url_path='') app.secret_key = getenv("SECRET_KEY") -app.config["SQLALCHEMY_DATABASE_URI"] = "postgresql://postgres@localhost/postgres" +app.config["SQLALCHEMY_DATABASE_URI"] = getenv("SQLALCHEMY_DATABASE_URI") db.init_app(app) import routes diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..b8351fe --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[tool.poetry] +name = "kyselma" +version = "0.1.0" +description = "Kyselmä - kysele, vastaile ja tutki tuloksia" +authors = ["Marjukka Jämbäck <mjamback@local>"] +license = "WTFPL" +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.11" +Flask = "^3.0.0" +flask-sqlalchemy = "^3.1.1" +psycopg2-binary = "^2.9.9" + +[tool.poetry.group.dev.dependencies] +pytest = "^7.4.3" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" |