🕹️ Find your gaming buddy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
app
migrations
tests
.dockerignore
.gitignore
Dockerfile
LICENSE.md
README.md
config.py
docker-compose.yml
manage.py
requirements.txt

README.md

ItalyGames Play

A bunch of us over at italygames felt the necessity to create a tool that would let us find other gamers to play with. Play is born from this idea and we hope it will help bring gamers from reddit closer together.

Come join us.

Development

Play is completely open source and on its early stages of development so we would love if you could help it grow by contributing. Play is being developed using Flask and Bootstrap. We also would like to thank all the awesome people that developed the open source libraries we are currently using: Flask-Login, Flask-Migrate, Flask-SQLAlchemy, Flask-Script, Flask-Testing, Flask-WTF, coverage, gunicorn, rauth.

Prerequisites

  • Python, virtualenv is recommended
  • MySQL and/or SQLite
  • Register a Reddit web app here

Please note that in order to use another DB you would need to check for SQLAlchemy support and install dependencies accordingly.

Setup

Virtualenv

Get a copy of the source code

$ git clone https://github.com/acifani/italygames-play.git

Setup virtualenv

$ cd italygames-play
$ virtualenv venv
$ source venv/bin/activate
(venv)$ pip install -r requirements.txt

Environment variables

You need to setup the following environment variables (export VARIABLE=VALUE if on Linux)

FLASK_CONFIG: Set to either development, testing or production based on your environment. You can add more config sets in config.py.

FLASK_APP: File that contains the app (not the app factory), in our case manage.py.

SECRET_KEY: Secret key needed by Flask to handle Sessions encryption. Check Flask Sessions docs.

DEV_DB_URI TEST_DB_URI DB_URI: Database URLs, if not set defaults to SQLite. You can modify defaults in config.py.

OAUTH_REDDIT_ID OAUTH_REDDIT_SECRET: The reddit app ID and Secret key, you can get those here after you register your app.

Database first time setup

(venv)$ python manage.py create_db
(venv)$ python manage.py db stamp head

Run

Development server

(venv)$ python manage.py runserver

Flask built-in development server: do NOT use for production as it is not build to manage more than one request at the time.

Production server

(venv)$ python manage.py gunicorn

Gunicorn WSGI HTTP server.

Optional parameters:

  • -w --workers Number of worker threads to use. Gunicorn recommends to set this to (2 x $num_cores) + 1.

  • -p --port Port number. Also supports Unix sockets.

  • -h --host Host address.

Test

(venv)$ python manage.py test

Run the test with unittest.

Optional parameters:

  • -c --coverage: Shows coverage report and generates HTML version inside tmp folder.

Database migrations

Database migrations and updates are managed with Flask-Migrate that works on top of Alembic. Please read the docs carefully.

You can use python manage.py db to access all the Flask-Migrate CLI commands.

Usually when you make a Model change you want to run python manage.py db migrate to generate migration scripts inside migrations/versions. Check those and if OK run python manage.py db upgrade to execute the changes on the database.

Docker

More info on how to build and deploy with Docker and docker-compose will be added Soon™.

Contacts

If you have any question or feedback please do get in touch with us on:

License

The content of this project itself is licensed under the Creative Commons Attribution 3.0 license, and the underlying source code used to format and display that content is licensed under the MIT License.