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.
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.
- 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.
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
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.
(venv)$ python manage.py create_db
(venv)$ python manage.py db stamp head
(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.
(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.
(venv)$ python manage.py test
Run the test with unittest
.
Optional parameters:
-c
--coverage
: Showscoverage
report and generates HTML version insidetmp
folder.
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.
More info on how to build and deploy with Docker and docker-compose will be added Soon™.
If you have any question or feedback please do get in touch with us on:
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.