from django.contrib.auth.decorators import permission_required from django.db.models.expressions import result from App.models import Machinery from rest_framework.decorators import permission_classes
Web-Application-Development Factory Machinery Status & Repair Tracking System
video screencast available on google drive: [https://drive.google.com/file/d/1J1SfhxfPSH9s6L5m172eVjWqnL8NcSJ7/view?usp=sharing] Meeting notes in [/Documentation/MeetingMinutes] User Mangual in [User_Guide.md]
Docker installed
Getting project
git clone https://github.com/jahz2323/WebApplicationDevelopment_GroupF.git
Creating virtual env , im using {environment}
python -m venv environment
environment\Scripts\activate
Install DockerDesktop, then run
docker-compose up -d --build
It installs for you everything you need, in order, which you would had done manually Without Docker
- It installs every dependencies in the file requirement.txt.
- It creates all group roles and assign their permissions.
- It loads the sample data in the folder fixtures. NB. "admin" user password is "admin", every other sample users has "project123"
remove /app to /app/media
Fix:
#!/bin/sh`
set to
!/bin/sh`
if another illegal option error change to bash
!/bin/bash
pip install --no-cache-dir -r requirements.txt
python manage.py setup_groups
python manage.py migrate
python manage.py loaddata App/fixtures/collections.json
python manage.py loaddata App/fixtures/users.json
python manage.py loaddata App/fixtures/machineries.json
python manage.py loaddata App/fixtures/machineryfaults.json
python manage.py runserver
loaddata might duplicate not unique samples like warnings if run multiple time (same With Docker)
Because all the groups and permissions are already set, you'll just have to check in the setup_groups.py which of the permission you want to be required for the function
then create the function like this:
if the permission code is "view_machinery"
@permission_required(App.view_machinery)
def any_fct(any_args):
your_fct_content
return your_result