This is the top level of my fork of the GamesDoneQuick donation tracker. This version has been updated for Python 3 and Django 2.0+, as well as adding some new functionality we wanted for our marathons such as Horaro schedule syncing for events, the option to automatically count eligible donations towards ticketed prizes, and an optional revamped donation page layout with responsive styling.
As a result of the upgrades, I found the old migrations were incompatible at least for PostgreSQL due to one of the previous migrations changing a foreign key on an existing field. The migrations have been regenerated from scratch for Django 2.0+ so if you're running some version of the GDQ tracker and you want to upgrade to this, you'll need to basically do a fresh install and dump/migrate your database records if you want to maintain them. Sorry for the inconvenience!
In order to deploy the tracker, some boilerplate code is neccessary for configuration and management. The goal of this repository is to make doing so as simple as possible for any given user to get started developing on the tracker.
- Install Git. I'm assuming if you're here, you know enough about git and version control to get started. You can check if you have git with the command
which git
, and which version you have withgit --version
. - Install Python. This version of the tracker requires Python 3.4+ and Django 2.0+. You can determine if Python is installed with the command
which python
, and which version of Python you have with the commandpython -V
. It may be installed aspython3
depending on your system. - Install pip This is the package management system we use with the tracker, and its generally the best option for getting Python packages.
- Install node. Optional If you want to use or develop on the fancy new Javascript UI (which right now only supports the schedule editor) you'll need this. Right now only v5.x is supported, but others may work.
- Install direnv. Optional, Linux/OSX only This will help set up an isolated development environment.
- Clone this repository, typically I put it in a folder called
donations
, which is the path to which this repo will be referred for the remainder of these instructions:> git clone https://github.com/PowerUpWithPride/donation-tracker-toplevel.git donations
- Make a copy of
example_local.py
underdonations
, and call itlocal.py
. This is where you will enter any deployment-specific settings for your instance of the website.> cp example_local.py local.py
- (optional) Change the
NAME
field under theDATABASES
variable to point at a different location if you wish. - There are some other config variables related to timezone, e-mail, google docs, and giantbomb's API. None of these are neccessary to get started, and mostly can be ignored unless you are interested in that specific feature. Documentation on these fields is lacking, but it shouldn't be too diffficult to figure out how they work if you take a look at
settings.py
.
- (optional) Change the
- Clone the submodules.
> git submodule update --init
- This will clone
tracker
(the main backend and the classic frontend),tracker_ui
(the fancy new experimental Javascript UI).
- This will clone
- Download the requirements in using pip:
> pip install -r tracker/requirements.txt
> pip install -r tracker_ui/requirements.txt
- If you are using Windows, you may need to delete the lines containing
psycopg2
andchromium-compact-language-detector
fromtracker/requirements.txt
(both are optional, and require compilation of C code, which is typically a hassle for people in a Windows environment). - If you are under 'nix or Mac, you'll probably need to
sudo
this/run as administrator, unless you're usingdirenv
as suggested above. - The default pip configuration performs a fresh install of all packages, meaning that previously installed packages will be uninstalled before being reinstalled. If you get any exceptions during uninstallation, you can try the flag
--ignore-installed
to leave those packages alone and continue with other packages.
- If you are using Windows, you may need to delete the lines containing
- Initialize the database. This app, and all the apps it depends on, can be initialized into the database using django's migrate command,
python manage.py migrate
. Notes:- This is the actual command that will create the
db/testdb
file on your machine (if it does not exist already). - If you are using a different location, or a different database type, you will need to make sure the permissions and settings are set up correctly.
- This is the general command to migrate all changes in the app. If you ever update any of the dependent libraries, or the tracker itself, you should run this command again.
- This is the actual command that will create the
- Create a superuser account for the admin with the command
python manage.py createsuperuser
and follow the prompts. This is the account you'll use to access your testing instance of the app. - Install the required npm packages. Optional
> cd tracker_ui && npm i
Only needed if you want to use or develop the fancy new experimental UI.
You can run the test server, using the command python manage.py runserver [port]
. The port
argument is optional; the default is 8000.
You can navigate to the tracker at http://127.0.0.1:8000/ (where 8000
is the the port specified). To view the admin site, go to: http://127.0.0.1:8000/admin/ and log in using the username/password you set up with createsuperuser
.
Simply run the build command in the tracker_ui
directory:
> webpack --config tracker_admin.release.webpack.js
This does two things:
- Builds the UI Javascript and CSS bundles and puts them in
tracker_ui/static/gen
. - Outputs a manifest file to
ui_admin.manifest.json
so that Django knows where to find the resulting bundles.
This will allow the tracker UI to function, though if you want to develop with it you'll want to use the development proxy below, otherwise you'll not only have a minified build (difficult to debug!) but you'll have to rerun the command every time you make a change.
Webpack has a development server that can proxy requests to the backend. Once you've installed the required packages, you can run the server with the following command while in the tracker_ui
folder:
> ./dev.sh
It defaults to port 8080, so simply visit http://127.0.0.1:8080/ and you should be able to view the site just like the Django development server.
Note that if you change the port that the server is running on you'll need to edit shared.webpack.js
to point to the correct port in the proxy section.
There are far too many different ways to deploy the server to go over every possibility here, so you should start with Deploying Django.
Note that node is NOT required to run the server in a production environment, it is ONLY needed to build the Javascript UI package. You can build it locally and simply copy the necessary files to your server. Don't forget the manifest file!
I haven't tested the Docker deployment at all with this, as we don't use Docker for our deployment. This was experimental in the GDQ version, so if you want to mess with it, do so at your own risk.