Coder Social home page Coder Social logo

rs-remote-job's Introduction

RS

TODO: update this !!!!!

Quick intro of project goes here.

Installation

pip install resource-server

Configuration

The application can configured like any other Flask application.

First it will load the bundled settings.py file to configure sensible defaults. Please see settings.py and https://terndatateam.bitbucket.io/flask_tern/ for details.

Next it will look for an environment variable RESOURCE-SERVER_SETTINGS. This environment variable should point to a python file which will be loaded as well. The format is exactly the same as in settings.py .

This project uses flask_tern. Be sure to check documentation and code https://bitbucket.org/terndatateam/flask_tern .

Flask-Cors: https://flask-cors.readthedocs.io/en/latest/

Development

Clone the source code and cd into the directory of your local copy. You may want to adapt settings in .flaskenv

# install project in editable mode
pip install -e '.[testing,docs]'
# to run tests use
pytest
# coverage report
pytest --cov --cov-report=html

The same can be done within a docker environment. The following is a simple example using alpine.

docker run --rm -it -p 5000:5000 -v "$(pwd)":/resource-server -w /resource-server alpine:3.10 sh
# install python in binary libs in container
apk add python3 py3-cryptography
# install pkg in container
pip3 install -e '.[testing]'
# run tests inside container
pytest
pytest --cov --cov-report=html

Run flask development server.

# locally
flask run
# within container
flask run -h 0.0.0.0

The app can then be accessed at http://localhost:5000

Database management

The project uses Flask-Migrate to manage databes schemas. Flask-Migrate uses Alembic to manage database migrations. As a first step it is necessary to initialise the Alembic configuration with flask db init. This will create a module resource-server.migrations with the necessarry settings and boilerplate for Alembic. Whenever there are changes to the database models, it is necessary to create a new migration step and apply this migration to the database. Per default the development environment uses sqlite as database backend, but this can easily be change by reconfiguring Flask-SQLAlchemy.

# init migrations
flask db init

# the following two steps are necessary when changing database models
# create new mgration / revision
flask db migrate

# update / create db. this step also initialises an empty database with the latest db schema.
flask db upgrade

rs-remote-job's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.