Planning your next courses easily.
This project is part of the Open Source Software Workshop at the Hebrew University of Jerusalem.
python3 -m venv venv
to install a new Python virtual environment.venv\Scripts\activate.bat
. source venv/bin/activate
. pip install --upgrade pip
pip install -r requirements.txt
to install the project's dependencies.python Closure_Project/manage.py migrate
Closure_Project
directory, choose Mark Directory as
and click Sources Root
(its icon will be colored cyan afterwards).python Closure_Project/manage.py runserver
You now have a django instance with the database configured (yet blank).
The next step would be populating the database with Course
information, so the whole ordeal
can work.
See the Parser
folder, or read the following subsection to learn more about the data
structures used.
Upon migrating the database, a data dump containing all parsed course and track data will be downloaded from the internet and inserted into the database.
You can run all tests by running pytest
(while in a virtual environment) at the Closure_Project
folder.
Note that a test database will be automatically created for DB tests, and it will undergo all migrations by default. While this is good in terms of testing the migrations themselves, it can be annoyingly slow during development.
You can disable migrations during testing by uncommenting ; addopts = --no-migrations
within the Closure_Project/pytest.ini
file,
this way the test database schemas will be generated based on the model's metadata. If you do so, make sure not to commit this change
into the repository, as the CI tests migrations indirectly by running the DB models.
python Closure_Project/manage.py createsuperuser
python Closure_Project/manage.py drf_create_token
and add {Autharization: Token <key>}
to request headers.To use the API, start the server with python Closure_Project/manage.py runserver
.
The base API url is https://<host>/api/v1
.
API documentation is available in https://<host>/redoc/
Try to use API with: https://<host>/swagger/
When making real requests, always remember to add the Authorization header to the request.
Feel free to PR or open issues.
Note that if you change the backend models, you should commit the resulting
migration along with the changed models. You can generate migrations by
doing python manage.py makemigrations rest_api
within the Closure_Project
folder.