GithubHelp home page GithubHelp logo

azure-devops-aws / directory_app Goto Github PK

View Code? Open in Web Editor NEW

This project forked from doddahulugappa/directory_app

0.0 0.0 0.0 11.03 MB

Teacher Directory

Shell 0.05% JavaScript 41.58% Python 12.86% CSS 34.53% HTML 10.84% Dockerfile 0.13%

directory_app's Introduction

Teacher's Directory

To setup the project follow the the instructions below

  • optional setup venv if required
    • pip install virtualenv
    • virtualenv venv
  • To activate venv in windows
    • venv\script\activate
  • To activate venv in linux
    • source venv/bin/activate

Clone the project

  • git clone https://github.com/doddahulugappa/directory_app.git
  • cd directory_app
    • pip install -r requirements.txt
    • python manage.py makemigrations
    • python manage.py migrate
    • python manage.py createsuperuser
    • python manage.py runserver <HOST>:<PORT>

Usage Guide

  • Open the url in any browser (http://HOST:PORT)
    • to see all the features as per the requirement, implemented in custom admin dashboard itself.
    • please navigate to admin panel from the user profile menu
    • Login with the created user creds and explore all the functionalities
  • Use Import option for Bulk Import
    • first import subjects.csv from data directory
    • second import teacher.csv from data directory
    • try to add subjects more than 5, will get an error
    • try to add duplicate email, will get an error
  • Export options given for the export data
  • Filter options for filtering data

Docker Setup

  • Create Dockerfile and save in the main directory
# Use the official Python image from the Docker Hub
FROM python:3.8.2

# Make a new directory to put our code in.
RUN mkdir /directory_app

# Change the working directory.
WORKDIR /directory_app

# Copy to code folder
COPY . /directory_app/

# Install the requirements.
RUN pip install -r requirements.txt

# Run the application:
CMD python manage.py runserver 0.0.0.0:8000
  • Build Docker Image
docker build -t directory_app .
  • Run Docker Image
docker run -it -p 8020:8020 directory_app
  • Tag Docker Image
docker tag directory_app_v1 doddahulugappa/django:v2
  • Push Docker Image
docker push doddahulugappa/django:v2
  • Azure ACR
az login
az acr login --name myregistry
docker login myregistry.azurecr.io
docker tag directory_app myregistry.azurecr.io/huli/directory_app
docker push myregistry.azurecr.io/django/directoryapp

Celery Integration

pip install celery
pip install redis
pip install django-celery-results
pip install django-celery-beat

CELERY_BROKER_URL = 'redis://127.0.0.1:6379'
CELERY_ACCEPT_CONTENT = ['application/json']
CELERY_RESULT_SERIALIZER = 'json'
CELERY_TASK_SERIALIZER = 'json'
CELERY_TIMEZONE = 'Asia/Dubai'
CELERY_RESULT_BACKEND = 'django-db'

  • command to start celery worker and celery beat
celery -A directory_app.celery worker --pool=solo -l info
celery -A directory_app beat -l info --scheduler=django_celery_beat.schedulers.DatabaseScheduler

Redis for windows

Download msi file from below and install

GraphQL integration

  • settings.py
pip install graphene-django
INSTALLED_APPS = (
    # ...
    'graphene_django',
)

GRAPHENE = {
    'SCHEMA': 'app.schema.schema' # Where your Graphene schema lives
}
  • urls.py
from django.conf.urls import url
from graphene_django.views import GraphQLView

urlpatterns = [
    # ...
    url(r'^graphql$', GraphQLView.as_view(graphiql=True)),
]
  • schema.py as similar path as settings.py
from graphene_django import DjangoObjectType
import graphene

class User(DjangoObjectType):
    class Meta:
        model = UserModel

class Query(graphene.ObjectType):
    users = graphene.List(User)

    @graphene.resolve_only_args
    def resolve_users(self):
        return UserModel.objects.all()

schema = graphene.Schema(query=Query)

query = '''
    query {
      users {
        name,
        lastName
      }
    }
'''
result = schema.execute(query)
  • Sample Queries
{
  subjects {
    subjectName
  }
}

{
  teachers {
    firstName
    lastName
    phoneNumber
    roomNumber
    emailAddress
    profilePicture
  }
}

directory_app's People

Contributors

doddahulugappa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.