This is the source for http://afterhoursgaming.tv/.
Want to contribute? Check out CONTRIBUTING.md!
You should be familiar with Python 2.7, Django 1.4, and NodeJS 0.10. This site also makes use of Redis, Celery, South, Pinax, and a few other things.
First, fork this repo by clicking the "Fork" button above. Then clone it locally.
Install pip and virtualenv (you might need to run this as root):
$ easy_install virtualenv
$ easy_install pip
Create a virtual environment directory somewhere outside of the repo:
$ virtualenv --distribute ENV
Source that environment (you might want to add this to your .bashrc
/.zshrc
):
$ . ENV/bin/activate
NOTE: As of Oct 1, 2013, Git versions 1.3 and newer break pip, so you need to install the bleeding-edge version of pip. More info here.
$ pip install -U -e git+https://github.com/pypa/pip.git@develop#egg=pip-dev
Install all of the required libraries. This takes a while, so go grab some coffee:
$ pip install -r requirements.txt
Visit http://www.lfd.uci.edu/~gohlke/pythonlibs/ to download the following precompiled packages:
- psycopg2
- lxml 2.3
- PIL
- greenlet
- cython
Remove the line lxml==2.3
from ahgl/requirements.txt
before continuing to the next step.
$ cp ahgl/local_settings.py.dist ahgl/local_settings.py
local_settings.py
is sourced by settings.py
and isn't checked in, so put any changes you need for development in there.
- Mac OS X: Grab Postgres.app (easiest) or
brew install postgres
(easy) - Debian/Ubuntu:
sudo apt-get install postgresql
- Windows: Go here
Create the database:
$ psql -h localhost
> create database ahgl;
CREATE DATABASE
Initialize the tables:
$ ./manage.py syncdb --noinput
$ ./manage.py migrate
Load some sample data:
$ ./manage.py loaddata ahgl/fixtures/dev1.json
$ ./manage.py loaddata ahgl/fixtures/dev2.json
$ ./manage.py runserver
First, install Grunt and Bower:
$ npm install -g bower grunt-cli
Then install the frontend dependencies:
$ cd ahgl/static/js/app
$ npm install
$ bower install
Run the frontend:
$ grunt serve
Now visit http://localhost:9000/ and you should see something that looks like AHGL!
Go to http://localhost:8000/admin and login with admin
/ admin
.
The CMS plugin edits a lot of the static stuff.
The profiles/ and tournaments/ directories have most of the important models and views. Lots of views are the newer Django class-based views.
The admin view (http://localhost:8000/admin) is worth poking through.
GLHF!
If you're working on parts of the site that use Django templates, you'll probably want to keep the Angular assets in sync since all of the Django templates use the Angular header and footer.
First, install Nodemon:
$ npm install -g nodemon
Then run this, which will run the production-ready grunt build
when important Angular assets change:
$ cd ahgl/static/js/app
$ nodemon --verbose -e js,less,html \
-i dist/\* -i .tmp/\* -i app/scripts/config.js -i app/styles/main.css \
`which grunt` build
Basically, create a fresh branch, run grunt to build static files, add them as a commit, and push the branch:
$ git branch -D staging
$ git checkout -b staging
$ grunt --gruntfile ahgl/static/js/app/Gruntfile.js build
$ git add --force ahgl/static/js/{dist,app/scripts/config.js}
$ git commit -m "Checking in production files to app/dist"
$ gondor deploy <env> HEAD