1. python 2.7
2. foreman
3. gunicorn
4. local virtualenv install
5. postgresql 9.1
6. phantomjs
-
Install virtualenv:
sudo apt-get install python-virtualenv
. -
Install foreman:
gem install foreman
You may need to first install
gem
withsudo apt-get install ruby1.9.1
.
-
Install gunicorn dependencies:
sudo apt-get install -y libevent-dev python-gevent
. -
Install postgresql:
sudo apt-get install postgresql-9.1 postgresql-client-9.1 postgresql-server-dev-9.1
.
You may want to change the default password for the postgres user with
sudo -u postgres psql
- this will get you into the psql shell as the postgres user. Then you canalter password postgres password 'some_pass';
to give the postgres user an actual password.
-
Set up the local database for development, perform the following commands in the terminal after installing postgres.
psql -Upostgres
orsudo -u postgres psql
CREATE USER tgb_db_admin with PASSWORD 'ilovetgb';
ALTER USER tgb_db_admin CREATEDB;
CREATE DATABASE tgb_db with OWNER tgb_db_admin;
\q
-
Download and install the python dev package with
sudo apt-get install python-dev
. -
Clone the_game_bazaar repo into a directory with
git clone https://github.com/hellochar/the_game_bazaar.git
. -
Create and activate virtualenv within the cloned repository by doing
virtualenv --distribute venv
and thensource venv/bin/activate
. Then install dependencies withpip install -r requirements.txt
. -
Populate the database model with
python manage.py syncdb
.
To run locally: foreman start
and then visit http://localhost:5000
You will have to source venv/bin/activate
in each terminal you want to develop in.
Run the TEST bash file as so:
./TEST
To test the javascript models (unit tests), visit the domain /jasmine. Each line of text that is green is a successful test.
You may install phantomjs by downloading the binary from http://phantomjs.org/download.html and putting it in your PATH. Installing phantomjs
will have ./TEST
automatically run the jasmine tests from the CLI and output their status.
The TEST file will automatically generate a coverage report for the Django server and the information will be output to the terminal.
It is possible to view this coverage report in HTML format by opening htmlcov/index.html after the test is complete.
If you get errors related to 'permission denied', chances are the 'tgb_db_admin' user doesn't have createdb permission. To fix this, run a postgres shell with
psql
You should be logged in as a superuser (the prompt will look like username=#
instead of username=>
). Then execute the following sql:
ALTER USER tgb_db_admin CREATEDB;
You can now quit the shell with \q
.
python manage.py reset_db --router=default
python manage.py syncdb
This will delete all your current data and update the db to have the new fields in the models.
- First tag the release branch with a descriptive name of the release with
git tag -a <tagname> -m "message"
- Push it to github with
git push --tags
. - Then push to heroku with
git push heroku release
. - If you need to reset the database in heroku (which you most likely will), you can't
reset_db
since Heroku doesn't allow it. Instead useheroku pg:reset DATABASE_URL
, followed byheroku run python manage.py syncdb
.