Skip to content

For Doing Django Tutorial: The Local Library website steps by steps

License

Notifications You must be signed in to change notification settings

Alexander-Development/local_library_website

 
 

Repository files navigation

local_library_website

Abstract

  1. For Doing Django Tutorial: The Local Library website steps by steps.
  2. Extend and prepare My skills to find some good web-backend/devops/architecture jobs.
  3. Practice system architecture design.
  4. Try RDBMS(Relational Database Management System): SQLite, PostgreSQL

Prerequisites

  • Python == 3.8.16
  • pyenv+poetry
  • Project dependcy detialls will be in pyproject.toml/poetry.lock
  • PostgreSQL or builtin SQLite
  • tree
    • a CLI tools to list contents of directories in a tree-like format.

To-do-list and troubleshooting

#src: https://docs.djangoproject.com/en/4.2/ref/models/fields/#decimalfield
#Add IntegerField with "YYYY" year format
    year_of_birth = models.IntegerField(null=True, blank=True)
    year_of_death = models.IntegerField(null=True, blank=True)

Quick Start

#check out prerequisites to prepare your environment

#spawns a virtual environment
poetry shell

#add packages
poetry add django
poetry add diagrams

#for help
python3 manage.py help

#Creating a superuser for Django CMS system
python3 manage.py createsuperuser

#run devserver
python3 manage.py runserver

#Warning: You'll need to run these commands every time your models change in a way that will affect the structure of the data that needs to be stored (including both addition and removal of whole models and individual fields).
python3 manage.py makemigrations
python3 manage.py migrate

#run test
python3 manage.py test
#Showing more test information
python3 manage.py test --verbosity 2
#Speeding things up
python3 manage.py test --parallel auto
#Running specific tests
python3 manage.py test catalog.tests.test_models
python3 manage.py test catalog.tests.test_views
python3 manage.py test catalog.tests.test_forms


#
python3 manage.py shell

#src: https://docs.python.org/3.8/library/sys.html#sys.path
#A list of strings that specifies the search path for modules. 
#Initialized from the environment variable PYTHONPATH, plus an installation-dependent default.
python -c "import sys; print(sys.path)"

#add env PYTHONPATH
export PYTHONPATH=/path/to/your/module:$PYTHONPATH

#add packages by poetry
poetry add "psycopg[binary,pool]"

Others

About

For Doing Django Tutorial: The Local Library website steps by steps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 75.1%
  • HTML 24.7%
  • CSS 0.2%