Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
dwreeves committed Nov 20, 2024
1 parent be067dc commit 7162a0a
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 25 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ This code base is built in Python 3.10+ and utilizes the Flask library heavily.
```shell
docker compose build
docker compose up -d
docker compose exec web flask psql init
docker compose exec flask update-db
docker compose up
```

Expand Down
4 changes: 2 additions & 2 deletions app.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"buildpacks": [
{ "url": "heroku/python" }
],
"scripts": { "postdeploy": "flask psql init" },
"scripts": { "postdeploy": "flask update-db" },
"addons": [
"scheduler",
"mailgun:starter",
Expand Down Expand Up @@ -58,7 +58,7 @@
"SECRET_KEY": { "generator": "secret" },
"SEND_TWEETS": {
"description": "If false, then 'flask update-website' doesn't send tweets.",
"value": "true"
"value": "false"
},
"USE_CELERY": {
"value": "true",
Expand Down
13 changes: 0 additions & 13 deletions app/data/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

import pandas as pd
from flask import current_app
from flask_postgres import init_db_callback
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy import text
from sqlalchemy.exc import ResourceClosedError
Expand Down Expand Up @@ -63,17 +62,5 @@ def execute_sql_from_file(file_name: str) -> Optional[pd.DataFrame]:
return execute_sql(s)


@init_db_callback
def init_db():
import alembic.config

alembic.config.main(["upgrade", "head"])

# Now update the database
from app.data.processing.core import update_db

update_db()


def get_current_time() -> pd.Timestamp:
return pd.Timestamp("now", tz="UTC").tz_convert("US/Eastern").tz_localize(None)
1 change: 0 additions & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ flask-cors
Flask-DB
Flask-Mail
Flask-SQLAlchemy
flask-postgres
flask-talisman
Flask
flower
Expand Down
6 changes: 0 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ click==8.1.7
# click-plugins
# click-repl
# flask
# flask-postgres
# rich-click
# schemathesis
click-didyoumean==0.3.1
Expand Down Expand Up @@ -85,7 +84,6 @@ flask==3.1.0
# flask-cors
# flask-db
# flask-mail
# flask-postgres
# flask-sqlalchemy
# sentry-sdk
flask-admin==1.6.1
Expand All @@ -100,13 +98,10 @@ flask-db==0.4.1
# via -r requirements.in
flask-mail==0.10.0
# via -r requirements.in
flask-postgres==0.2.5
# via -r requirements.in
flask-sqlalchemy==3.1.1
# via
# -r requirements.in
# flask-db
# flask-postgres
flask-talisman==1.1.0
# via -r requirements.in
flower==2.0.1
Expand Down Expand Up @@ -324,7 +319,6 @@ sqlalchemy==2.0.36
# -r requirements.in
# alembic
# flask-db
# flask-postgres
# flask-sqlalchemy
# sqlalchemy-utils
sqlalchemy-utils==0.41.2
Expand Down
5 changes: 3 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from flask.testing import FlaskClient
from pytest_postgresql.janitor import DatabaseJanitor

from app.data.database import init_db
from app.data.globals import cache as _cache
from app.data.processing.core import update_db
from app.main import create_app
Expand Down Expand Up @@ -73,7 +72,9 @@ def _db(app):
from app.data.database import db

with app.app_context():
init_db()
import alembic.config

alembic.config.main(["upgrade", "head"])
update_db()
yield db

Expand Down

0 comments on commit 7162a0a

Please sign in to comment.