Skip to content

yimolasa/django01

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Apps

polls

official tutorials

denglu

log in sample

denglu2

log in with AD account

psql01

multiple DB connection

tips

  • Display README.md in VScode

    Ctrl + Shift + V

  • Basic

    django-admin startproject djg01         # initial project
    python manage.py startapp polls         # create new app (polls) 
    python manage.py createsuperuser        # create admin  
    python manage.py runserver              # run web service
  • Play with database
    python manage.py makemigrations polls   # check changes of INSTALLED_APPS (polls) && generate a migration file  
    python manage.py sqlmigrate polls 0001  # display these changes (CREATE TABLE "polls_question" ("id" integer NOT NULL PRIMARY KEY AUTOINCRE......))        
    python manage.py migrate                # operate with database based on the migration file 
  • Pre-install
    pip install PyMySQL                     # for mysql
    pip install psycopg2                    # for PostgreSQL
  • Decorator
@login_required(login_url="denglu:login" ) # , redirect_field_name="xxxx",
def al(request,username):
    print(username)
    return HttpResponse(username) 

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published