diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/conditional_files.json b/fastapi_template/template/{{cookiecutter.project_name}}/conditional_files.json index ee4dfcaf8d03e99058b6df67bea87201671ffb55..3dfef3b92b416e80ba668b499e8dee0992d7ad32 100644 --- a/fastapi_template/template/{{cookiecutter.project_name}}/conditional_files.json +++ b/fastapi_template/template/{{cookiecutter.project_name}}/conditional_files.json @@ -38,7 +38,8 @@ "alembic.ini", "{{cookiecutter.project_name}}/db_sa/migrations", "{{cookiecutter.project_name}}/db_ormar/migrations", - "{{cookiecutter.project_name}}/db_tortoise/migrations" + "{{cookiecutter.project_name}}/db_tortoise/migrations", + "{{cookiecutter.project_name}}/db_piccolo/migrations" ] }, "Alembic migrations": { diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/models/__init__.py b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/__init__.py similarity index 100% rename from fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/models/__init__.py rename to fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/__init__.py diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/dao/migrations/__init__.py b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/dao/migrations/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/dao/piccolo_app.py b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/dao/piccolo_app.py new file mode 100644 index 0000000000000000000000000000000000000000..14feaaf0c1c81e115881b5f702a11dcfc3ed2276 --- /dev/null +++ b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/dao/piccolo_app.py @@ -0,0 +1,16 @@ +import os +from piccolo.conf.apps import table_finder + +from piccolo.conf.apps import AppConfig + +CURRENT_DIRECTORY = os.path.dirname(os.path.abspath(__file__)) + +APP_CONFIG = AppConfig( + app_name='dao', + migrations_folder_path=os.path.join(CURRENT_DIRECTORY, 'migrations'), + table_classes=table_finder( + modules=['{{cookiecutter.project_name}}.db_piccolo.dao.tables'] + ), + migration_dependencies=[], + commands=[] +) diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/models/dummy_model.py b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/dao/tables.py similarity index 100% rename from fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/models/dummy_model.py rename to fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/db_piccolo/dao/tables.py diff --git a/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/piccolo_conf.py b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/piccolo_conf.py index d4471d3cb36360d225b68b83075bbde0d5bc242e..0383085982d836db32a2ea8f5d4b6bad6f58b883 100644 --- a/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/piccolo_conf.py +++ b/fastapi_template/template/{{cookiecutter.project_name}}/{{cookiecutter.project_name}}/piccolo_conf.py @@ -18,5 +18,7 @@ DB = SQLiteEngine(path=settings.db_file) {%- endif %} # A list of paths to piccolo apps -# e.g. ['blog.piccolo_app'] -APP_REGISTRY = AppRegistry(apps=[]) +# e.g. ['sample_project.db_piccolo.dao.piccolo_app'] +APP_REGISTRY = AppRegistry( + apps=['{{cookiecutter.project_name}}.db_piccolo.dao.piccolo_app'] +)