Giter VIP home page Giter VIP logo

flask-large-app-example-2's Introduction

GitHub Status

Simple Flask application that queries GitHub's API for repository metadata and displays it in a jQuery-powered view.

Requirements:

  • Python 2.7
  • OS X or Ubuntu
  • MySQL (development or production)
  • SQLite (testing)

[Build Status] (https://travis-ci.org/Robpol86/Flask-Large-App-Example-2) [Coverage Status] (https://codecov.io/github/Robpol86/Flask-Large-App-Example-2)

Testing

Testing the project is simple. You run these commands after cloning the git repo on OS X or Ubuntu:

  • pip install -r requirements.txt -r tests/requirements.txt
  • py.test --cov-report term-missing --cov github_status tests

SQLite is used as the testing database. It will automatically be created in the git repo's root directory.

Development

To work on the project on your OS X development environment you just clone the git repo and run: pip install -r requirements.txt

Then you need to setup your MySQL database. Reference ./github_status/config.py under the HardCoded class for the MySQL user name and password to create, as well as the database name to create. Give that user create, delete, drop, insert, select, and update privileges on that database.

Now run this command to create the schema: ./manage.py create_all

To start the development server locally, run: ./manage.py devserver

Then browse to http://localhost:5000.

Production

Running the project in a production environment requires installing requirements and running the Tornado production server. Run these commands after cloning the git repo or SCP'ing the project files to the host:

  • pip install -r requirements.txt
  • sudo mkdir /var/log/github_status /etc/github_status; sudo chown ghs:root /var/log/github_status /etc/github_status

Create the GitHub Status config file /etc/github_status/config.yml with something like this:

_SQLALCHEMY_DATABASE_DATABASE: 'github_status'
_SQLALCHEMY_DATABASE_HOSTNAME: 'localhost'
_SQLALCHEMY_DATABASE_PASSWORD: 'github_p@ssword'
_SQLALCHEMY_DATABASE_USERNAME: 'github_service'

Now run this command to create the schema: ./manage.py create_all --config_prod

Finally start the production server: ./manage.py prodserver --config_prod -p 8080 -l /var/log/github_status &

The above commands assumes you've created the ghs user to run the application and will listen on TCP port 8080, which a load balancer or such will forward traffic to. You may want to write an init script to have the application run as a service instead of running the last command.

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.