Skip to content

jahz2323/WebApplicationDevelopment_GroupF

Repository files navigation

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

Documentation

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]

Requirements

Docker installed

Deployment

Getting project

  git clone https://github.com/jahz2323/WebApplicationDevelopment_GroupF.git

Creating virtual env , im using {environment}

  python -m venv environment
  environment\Scripts\activate

Setting dependencies, sample Users/Datas and launching project

With Docker

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

  1. It installs every dependencies in the file requirement.txt.
  2. It creates all group roles and assign their permissions.
  3. It loads the sample data in the folder fixtures. NB. "admin" user password is "admin", every other sample users has "project123"

Common errors: Guide to fix

Directory already made

image

remove /app to /app/media

image

Illegal option error

image

Fix:

#!/bin/sh`
set to
!/bin/sh`
if another illegal option error change to bash
!/bin/bash

after: image

Without Docker

Install dependencies

    pip install --no-cache-dir -r requirements.txt

Create group roles and assign their permissions

    python manage.py setup_groups

Run migrations, add samples and run server

    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)

Open and Navigate to

http://127.0.0.1:8000

Create functions with permissions

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 5