- Clone the repo :
$ git clone https://gitlab.com/sreecodeslayer/contact-app-restful.git
$ cd contact-app-restful
- Create databases :
contacts
andcontacts_test
in postgres
psql> CREATE DATABASE contacts;
psql> CREATE DATABASE contacts_test;
- Install requirements in a virtual env of Python 3.6+
$ pip install -r requirements.txt
$ pip install -e .
Optionally to run tests, install Pytest as well
$ pip install pytest
- Run migrations
$ export CONTACTS_ENV=dev
$ export FLASK_APP=run.py
$ flask db init
$ flask db migrate
$ flask db upgrade
- Optionally run tests
$ pytest
- Running API via gunicorn
$ pip install gunicorn
$ gunicorn run:application -w 4
Configurations regarding Postgres Connection is inside contacts/config.py
and can be configured as per the needs. Currently the app will try to connect with postgres:postgres
to locahost
- Testing covers unit tests for User model and Records model (contacts table)
- Testing also covers different aspects of API integration with the models like the Login/Signup cases, Auth based API requests for CRUD of contacts.
This project was initiated using the cookiecutter from my github repo