Tools to help a Honk band manage itself!
Features:
This project is targeted at Python 3.12, and the minimum supported version is Python 3.10. The development environment uses Docker to make installing Postgres easier. Install Docker Desktop before continuing.
Create Python sandbox
cd GO3 # the place you checked out the source for Gig-O-Matic 3
python3 -mvenv .venv
source .venv/bin/activate
Install required Python packages:
pip install -r requirements.txt
ln -s go3/.env.example go3/.env # Optional: copy instead and edit the file to taste
Start the DB engine
docker compose up -d db
sleep 30 # wait for DB to finish initializing
Run the migrations
python manage.py migrate
OPTIONAL: Fill database with sample data
python manage.py loaddata fixtures/testdata.json
Create an administrative user
python manage.py createsuperuser
Launch Gig-O! At this point, you should be able to run the project locally:
python manage.py runserver
You can log in with the user created above.
OPTIONAL: Start the task queue Certain actions kick off activities that run in the background, using DjangoQ to manage the queue. This runs concurrently, so kick it off in a separate shell. You should see the tasks come and go in the DjangoQ section of the admin pages.
python manage.py qcluster
OPTIONAL: set up the scheduled tasks Some tasks - like updating calendar feeds, archiving gigs, send snooze reminders - require repeating events to be scheduled in DjangoQ. This should only be done once - check the DjangoQ "scheduled tasks" page to see the events that have been set up.
python manage.py schedule_tasks
The live site uses various third party services to function correctly. In local development, these are all bypassed, though they can be enabled as needed by putting appropriate configuration into go3/.env
.
When testing emails in the local development environment, we usually do not want to actually send the email. Instead, they are written out as separate files in the tmp/
directory within the GO3 root directory.
We use sqlite3 for the test suite for now
python manage.py collectstatic
DATABASE_URL="sqlite:///gig-o-matic-test.sqlite" python manage.py test
To test the GraphQL endpoint, run the project locally and navigate to http://127.0.0.1:8000/graphql
in your browser.
Queries in the GUI are formatted as such:
query {
allBands {
band {
name,
hometown,
creation_date
}
}
}
We are converting the project to autopep8
.
Django-Q is used as a task queue, and the default setting uses the standard database as a broker. Tasks can be serialized into the database without any additional configuration. However, a separate process is used to run these items in the queue. This can be launched with
python manage.py qcluster
You can cause tests to run synchronously by setting 'sync': True
in the Q_CLUSTER
settings.