Aims to be a website that can manage TrueSkill based leaderboards for game players of any kind.
Great site describes it here:
http://www.htmlgoodies.com/beyond/reference/create-a-django-python-project-with-pydev.html
But read that only if you get stuck I guess following the steps below. I've tried to be complete but it can be improved with each new effort. So if you're starting out, note anything that you would improve below, and improve it - or ask me to!
Install needed dependencies, in a venv ideally. What follows is a Linux based approach (Windows will be different and if someone wants to write up a Windows set of steps please do) and makes two key assumption you need to modify as you desire:
~/.virtual-envs
. A totally arbitrary subsumption to illustrate the steps and just where I happen to keep mine. You can keep yours wherever you like, just replace ~/.virtual-envs
with a directory you want to home for your venvs.~/workspace
. Again, you can keep them wherever you like, bust just substitute ~/workspace
with the directory you choose to call home for your development projects.# Get the basic together
sudo apt install python3 python3-pip python3-venv postgresql pgadmin4 git
# Create an activate a venv
mkdir ~/.virtualenvs # if necessary
python3 -m venv ~/.virtualenvs/CoGs
source ~/.virtualenvs/CoGs/bin/activate
# Prep the venv for use
pip install --upgrade pip
pip install wheel
# Get the CoGs code base (because we need requirements.txt which describes the Pyhton packages we'll need)
mkdir ~/workspace # if necessary
cd ~/workspace
git clone https://github.com/bernd-wechner/CoGs.git # Or Fork on GitHub first and clone your repo (better)
# Install the requirements
pip install -r requirements.txt
Install Eclipse and Pydev
Recommend avoiding the ubuntu package and just going straight to https://www.eclipse.org and get the latest Eclipse from there.
Then install PyDev from within Eclipse by adding these repositories:
pydev - http://pydev.org/updates
Django Template Editor - http://eclipse.kacprzak.org/updates
I had enormous troubles getting PyDev to work from the ubuntu repositories and the PyDev support guys suggested the above which worked a breeze.
Now load the project in Eclipse:
~/workspace
(if in 1. above you set one up use that)git clone https://github.com/bernd-wechner/CoGs.git
(or fork on github and clone your repo which is generally better) andSeed your database
I want to find a way to do this in a simple command but in the mean time.
Database tips:
Make sure you can log in to the database. That is edit the file: pg_hba.conf
It migth be in /var/lib/pgsql/data
or /etc/postgresql/vv/main
where vv
is the postgresql version.
And make sure the connection METHOD for local is "md5" not "peer".
Peer authentication will mean you're always trying to login with your account name, but CoGs uses the CoGs user, and you want to be able to log in as the CoGs user by providing a username and password.
Restart the postgresql server after editing it with:
service postgresql restart
Export data was done with:
python3 manage.py dumpdata --format xml --indent 4 > data.xml
python3 manage.py dumpdata --format json --indent 4 > data.json
python3 manage.py dumpdata --format yaml --indent 4 > data.yaml
Just to get all possible formats for the heck of it. Only need one.
Import data is then done with:
python3 manage.py loaddata <file>
where <file> is one of the three files I dumped with dumpdata.
That should see you with a seeded database.
Try it out
Open the CoGs project in Eclipse
Right click the project then click Debug As...
then PyDev: Django
In your Console panel you should see something like:
Performing system checks...
System check identified no issues (0 silenced).
December 05, 2016 - 11:52:55
Django version 1.10.1, using settings 'CoGs.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Now dive in ...
Two tools I've used:
postgresql_autodoc
sudo apt install postgresql-autodoc
postgresql_autodoc -d CoGs -u CoGs --password=ManyTeeth
Had login problems and had to fix var/lib/pgsql/data/pg_hba.conf making local connections use md5 connection method.
This produces CoGs.dia and Cogs.dot which you need dia to view:
sudo apt install dia
sudo apt install xdot
Alas the dia file seems to have all tables coincident though neatly moverable yet I can't find a cool layout option. The dot file is well laid out. Butit proves to be large and so schemaSpy produces a more navigable result.
schemaSpy downloaded schemaSpy from: https://sourceforge.net/projects/schemaspy/ Installed the file:
mv schemaSpy_5.0.0.jar ~/bin/schemaSpy
chmod +x ~/bin/schemaSpy
downloaded the Java postgresql driver from: https://jdbc.postgresql.org/download.html
Installed the file:
sudo mv postgresql-9.4.1211.jar /usr/share/java
ran schemaSpy in my Doc folder:
schemaSpy -t pgsql -cp /usr/share/java/postgresql-9.4.1211.jar -host localhost -db CoGs -s public -u CoGs -p ManyTeeth -o .
Produces a rich documentation site under index.html including a better schema diagram, but you cna't move things around, it's well layed out but fixed in place.
You can click on any table and get a cool relative view though. And if you install xdot can view the .dot files.