In all the methods below, you first please clone this repository, and navigate to top level project folder.
Using pipenv, you just need to run
pipenv install
.
Run Django by pipenv run python manage.py <options see under "Usage">
or you
can enter a shell by pipenv shell
and you don’t need to prefix pipenv run
.
virtualenv env
source env/bin/activate
pip install -r requirements.txt
If you have something like Debian Wheezy, installing either virtualenv or python>=3.5 is not that easy, you can use conda.
bash
)conda create -n <some name for your pywaschedv environment> python=3
source activate <the pywaschedv environment name>
This method works, but is rather hacky and not recommended.
cowbuilder --create --distribution stretch --basepath /var/cowdancer/stretch
cowbuilder --login --basepath /var/cowdancer/stretch --bindmounts "$HOME"
The reason for mounting HOME is to access the git repository and created
virtualenvs.adduser <username>
su - <username>
The repository does not contain all migration files. Therefore before first use of your instance, run
python manage.py makemigrations
python manage.py migrate
Further, quick setup of a waschuser for god and three machines as
required at TvK you can navigate to
http://localhost:$DJANGO_PORT/wasch/setup/
.
You need to login as superuser (change password for WaschRoss in
GodOnlyBackend as required).
As GodOnlyBackend depends on crypt, it only works in a POSIX
environment.
You can alternatively create a different superuser using manage.py
.
This method has not been rigorously tested yet though.
All created machines are initially disabled. Enable them as appropriate using the Django admin.
Like any django project you can start it with
python manage.py runserver $SOME_PORT
I'd also highly recommend using PyCharm, best way to set up (imho ;)) is as follows:
sudo add-apt-repository ppa:mystic-mirage/pycharm
sudo update
sudo apt-get install pycharm-community
Once it's installed, open the pywaschedv top level as an existing project. Then change the Python Interpreter to our virtual environment by going to File->Settings...->Project:->Project Interpreter. Choose the virtual env from the drop down combobox.
To setup the debug environment, go to Run->Edit Configurations.... Press the green + icon, and then choose Python from the listed options. Set the configuration name (Django Debug Config, or something sensible). Under the configuration tab, set the Script to the full path of the 'manage.py' file, and the script parameters to 'runserver'. You can then run the server with full debug support by pressing the debug buttons in the IDE.
For development of a remote desktop application for the activation of appointments, pywaschedv provides the enteapi RESTful API based on the Django REST framework.
Usage:
import requests
# get available appointments
appointments = requests.get('http://localhost/enteapi/v1/appointment/').json()
# authenticate
token = requests.post(
'http://localhost/enteapi/token-auth/',
json={"username": "Me", "password": "secret123"},
).json()['token']
pk = appointments[0]['pk']
# activate the first available appointment
requests.post(
'http://localhost/enteapi/v1/appointment/{:d}/activate/'.format(pk),
json={"enteId": 1},
headers={'Authorization': 'JWT ' + token})
# bonus: see the latest actual users for each machine
requests.get(
'http://localhost/enteapi/v1/appointment/last_used_for_each_machine/')