Skip to content
Arona Jones edited this page Aug 22, 2021 · 11 revisions

Most of the documents here assume a basic knowledge of how Python and Django work (hint, if I don't say something, Google it, you will find 10000's of answers). The documentation is purely to be specific to TEC's application of the framework.

Editing

Tom's Recommendations:

It is recommended that you use the PyCharm IDE by JetBrains. Whilst other editors are available, this is the best for integration with Django as it can automatically manage all the pesky admin commands that frequently need running, as well as nice integration with git.

For the more experienced developer/somebody who doesn't want a full IDE and wants it to open in less than the age of the universe, I can strongly recommend Sublime Text. It has a bit of a steeper learning curve, and won't manage anything Django/git related out of the box, but once you get the hang of it is by far the fastest and most powerful editor I have used (for any type of project).

Please contact TJP for details on how to acquire these.

Arona's Recommendations

I use a text editor. And a terminal. Job done. (Specifically a text editor with syntax highlighting and whitespace conversion {Xed}, I'm not a complete masochist.)

Python Environment

See First Time Setup

Development using Docker

docker build . -t pyrigs
docker run -it --rm -p=8000:8000 -v $(pwd):/app pyrigs

Sample Data

Sample data is available to aid local development and user acceptance testing. To load this data into your local database, first ensure the database is empty:

python manage.py flush

Then load the sample data using the command:

python manage.py generateSampleData

4 user accounts are created for convenience:

Username Password
superuser superuser
finance finance
keyholder keyholder
basic basic

Testing

Tests are contained in 3 files. RIGS/test_models.py contains tests for logic within the data models. RIGS/test_unit.py contains "Live server" tests, using raw web requests. RIGS/test_integration.py contains user interface tests which take control of a web browser. For automated Travis tests, we use Sauce Labs. When debugging locally, ensure that you have the latest version of Google Chrome installed, then install chromedriver and ensure it is on the PATH.

You can run the entire test suite, or you can run specific sections individually. For example, in order of specificity:

python manage.py test
python manage.py test RIGS.test_models
python manage.py test RIGS.test_models.EventTestCase
python manage.py test RIGS.test_models.EventTestCase.test_current_events