Skip to content

Code-Platoon-Assignments/django-school-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

School API

By the end of this assignment you will have a fully serviceable CRUD API with user authentication capabilities that will allow School staff to easily manage students and schollastic equipment.

Student Model

In this assignment we will create a Student Django Model with the following fields

field required type example data
name True string John W. Watson
student_email True string(email) johnnyBoy@school.com
personal_email False string(email) johnnyBoy@gmail.com
locker_number True int 137
locker_combination True string 37-68-98
good_student True boolean True

Django Set Up

Creating and activating VENV

  #creating venv
  python -m venv <name_of_env>

  #activating venv
  source <name_of_env>/bin/activate

Installing Django and starting a project with an app

    #installing Django
    pip install django

    #creating project
    django-admin startproject school_proj .

    #creating student app
    python manage.py startapp student_app

Creating Database

    createdb school_db

Don't forget to add the app under the INSTALLED_APPS section in settings.py and changing from sqlite to postgresql with a database name!

Installing Psycopg3 to speak with PostgreSQL

  pip install "psycopg[binary]"

Once the Student Model is completed makemigrations and migrate to the school_db

  python manage.py makemigrations
  python manage.py migrate

Running Tests

Replace the test.py file inside your app with the test.py file already attached to this repository.

Now you can run the test suite by typing the following

  python manage.py test
  • . means a test passed
  • E means an unhandled error populated on a test
  • F means a test completely failed to run

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •