Skip to content

keegancsmith/scrabble

Repository files navigation

Scrabble

This is a scrabble clone which uses HTML5's Canvas for the UI and Django and Eventlet for the server. The goal is to make a scrabble clone which works on iOS, Android and desktop machines.

Install

There currently isn't a publicly accessible server, but you can run your own server. Make sure you have redis running, see example_project/settings.py if you want to change the redis settings. Then you can run the following commands to get a running server:

$ sudo apt-get install python-virtualenv python-pip python-dev build-essential redis-server zip # Dependencies for Ubuntu
$ hg clone https://bitbucket.org/keegan_csmith/scrabble
$ cd scrabble
$ virtualenv --no-site-packages env
$ source env/bin/activate
$ pip install -r example_project/requirements.txt
$ (cd data; ./fetch_dictionaries.sh)
$ python example_project/manage.py syncdb
$ gunicorn_django -k gunicornsupport.EventletWorker example_project/settings.py

You should now have a server running at http://localhost:8000/

Alternative WSGI Servers

If gunicorn isn't your thing, you can use eventlet.wsgi by just running:

$ python run.py

or use spawning:

$ spawning --processes=1 --threads=0 -p 8000 run.application

Deployment

This section will explain deployment of the example application using nginx and gunicorn. Follow the same steps as in the install section to setup the example scrabble project. The next few steps assume the repository is cloned into /home/ubuntu/scrabble. If it isn't you will need to modify the nginx.conf:

$ sudo apt-get install nginx
$ sudo mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.bak
$ sudo cp data/nginx.conf /etc/nginx
$ sudo /etc/init.d/nginx restart
$ cp example_project/settings_prod.example.py example_project/settings_prod.py
$ vim example_project/settings_prod.py # Atleast change SECRET_KEY
$ python example_project/manage.py syncdb
$ python example_project/manage.py collectstatic
$ gunicorn_django -c data/gunicorn_conf.py example_project/settings.py

You should now have a server running at http://localhost/

This setup uses nginx to serve the static files, as well as reverse proxy requests to gunicorn.

About

Experiments with Django, eventlet, redis and HTML5 Canvas to make a Scrabble game.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published