|
|
7 years ago | |
|---|---|---|
| .. | ||
| databag | 7 years ago | |
| migrations | 7 years ago | |
| scripts | 7 years ago | |
| tests | 7 years ago | |
| .coveragerc | 7 years ago | |
| .gitignore | 7 years ago | |
| LICENSE | 7 years ago | |
| README.md | 7 years ago | |
| alembic.ini | 7 years ago | |
| dev_requirements.in | 7 years ago | |
| dev_requirements.txt | 7 years ago | |
| manage.py | 7 years ago | |
| requirements.in | 7 years ago | |
| requirements.txt | 7 years ago | |
| setup.py | 7 years ago | |
README.md
databag
A low code solution to implementing a restful API.
First time setup
Create a virtual environment and activate it. Now from the root project directory run ./scripts/bootstrap. This will install pip-tools and sync any dependencies for the first time.
To run the app you will need a postgres database. Create a development and a test database. Update the connection strings within the databag.settings.toml. At this time, if you choose to, you can remove the demo Todo code and replace it with your own Model. Otherwise create your first alembic migration using the alembic revision --autogenerate -m "your revision message" command. Finally, apply your first migration with alembic upgrade head.
Running the developement server
A manage.py script has been included with a collection of click cli functions to assist in development.
Note: the developement server command is not a production webserver. You will need to c
python manage.py runserver
Using the interactive interpreter
The manage.py script can be used to open an interactive interpreter with a configured molten application from your project.
python manage.py shell
Dependency management
Dependencies are managed via pip-tools.
Adding a dependency
To add a dependency, edit requirements.in (or dev_requirements.in
for dev dependencies) and add your dependency then run pip-compile requirements.in.
Syncing dependencies
Run pip-sync requirements.txt dev_requirements.txt.
Migrations
Migrations are managed using alembic.
Generating new migrations
alembic revision --autogenerate -m 'message'
Running the migrations
alembic upgrade head # to upgrade the local db
env ENVIRONMENT=test alembic upgrade head # to upgrade the test db
env ENVIRONMENT=prod alembic upgrade head # to upgrade prod
Testing
Run the tests by invoking py.test in the project root. Make sure you
run any pending migrations beforehand.