Skip to content

Commit

Permalink
fix app import error
Browse files Browse the repository at this point in the history
  • Loading branch information
RamuniN committed May 17, 2023
1 parent fe3c135 commit 412add2
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 6 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ You can also force all defined rounds to be open by setting the environment vari
To seed fund & round data to db

```
docker exec -ti <fund_store_container_id> scripts/load_cof_r2.py
docker exec -ti <fund_store_container_id> python -m scripts.load_cof_r2
```
```
docker exec -ti <fund_store_container_id> scripts/load_cof_r3w1.py
docker exec -ti <fund_store_container_id> python -m scripts.load_cof_r3w1
```
To amend the round dates
Expand Down
10 changes: 8 additions & 2 deletions scripts/load_cof_r2.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python3
# flake8: noqa
from app import app # noqa: E402
from config import Config # noqa: E402
from db.queries import insert_application_sections
from db.queries import insert_assessment_sections
Expand Down Expand Up @@ -51,7 +50,7 @@ def create_sections(path_prefix, round_id, forms_config):
# assessment_result = insert_assessment_sections(cof_form_config.COF_ROUND_2_ID, assessment_config)


with app.app_context():
def main() -> None:

# -- load fund and rounds --
fund_config = {
Expand Down Expand Up @@ -134,3 +133,10 @@ def create_sections(path_prefix, round_id, forms_config):
cof_form_config.COF_R2_ORDERED_FORMS_CONFIG,
)
create_sections("1", cof_form_config.COF_ROUND_2_W3_ID, None)


if __name__ == "__main__":
from app import app

with app.app_context():
main()
12 changes: 10 additions & 2 deletions scripts/load_cof_r3w1.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from app import app # noqa: E402
#!/usr/bin/env python3
from db.queries import insert_application_sections
from db.queries import insert_fund_data
from db.queries import insert_round_data
Expand Down Expand Up @@ -183,7 +183,8 @@
}
]

with app.app_context():

def main() -> None:
print("Inserting fund and round data.")
insert_fund_data(fund_config)
insert_round_data(round_config)
Expand All @@ -194,3 +195,10 @@
insert_application_sections(
COF_ROUND_3_WINDOW_1_ID, sorted_application_r3w1_sections
)


if __name__ == "__main__":
from app import app

with app.app_context():
main()

0 comments on commit 412add2

Please sign in to comment.