Coder Social home page Coder Social logo

aircompany_repo's Introduction

System requirements

  • python (approved version 3.6.6)
  • pip
  • virtualenv
  • mysql (approved version 8.0.13)

Installation steps

  • Clone github repo into any directory you like
  • Create your own virtual environment via virtualenv dev
  • Activate it by source dev/bin/activate for mac/linux users, dev\Scripts\activate for Windows
  • Install project depencies pip install -r requirements.txt
  • Specify elasticsearch url export ELASTICSEARCH_URL=http://localhost:9200
  • Specify your own db creds int aircompany.ini file
  • If you wanna run application in DEBUG mode type export FLASK_DEBUG=1 / export FLASK_ENV=development for mac/linux or set FLASK_DEBUG=1 / set FLASK_ENV=development for Windows (traces on pages will be avaiable)
  • Specify your app name in FLASK_APP var, export FLASK_APP=aircompany.py for mac/linux or set FLASK_APP=aircompany.py for Windows
  • Initialize db via flask db init && flask db upgrade
  • run server flask run

site will be avaiable at 0.0.0.0:5000/

Example of aircompany.ini

[config]
dbname=
dbpassword=
dbhost=
dbuser=
secret_key=youllneverguess
sqlalchemy_track_modifications=False
[email protected]
elasticsearch_url=http://localhost:9200

API Usage

First, autheticate as user you want to get request, just put to command line http --auth <username>:<password> POST http://localhost:5000/api/v1/tokens

NOTE: generated token expires in a hour

And then you can make API calls, for example http GET http://localhost:5000/api/v1/users "Authorization:Bearer <token_you_got_from_>" Reason: it works on linux/mac/windows

Probable issues

sometimes someone push several changes in db, sometimes it kind of hurt

  • when you try to flask db migrate -m "some change"" (or update db after migration) alembic will say: No, I couldnt add/delete/update table field No worries, just check attentively your migration files and running instance of db
  • the second one when alembic try to get revision hash that doesnt exists, just drop alembic_version in your db and remove migrations dir then flask db init && flask db migrate -m "again" && flask db upgrade

aircompany_repo's People

Contributors

shukal94 avatar dbulka avatar zipziprar avatar

Watchers

 avatar Andrei Kratovich avatar

Forkers

dbulka

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.