项目作者: utsukushiihime

项目描述 :
Django Cheatsheets
高级语言:
项目地址: git://github.com/utsukushiihime/django-cheatsheet.git
创建时间: 2020-10-03T20:10:14Z
项目社区:https://github.com/utsukushiihime/django-cheatsheet

开源协议:

下载


django-cheats

Django Cheatsheet

Create and navigate to the project directory

  1. $ mkdir <directory-name> && cd <directory-name>

Create a python virtual environment

  1. $ python3 -m venv .env

Activate the virtual environment

  1. $ source .env/bin/activate

Install django and psycopg2-binary

  1. $ pip3 install django psycopg2 psycopg2-binary

Create a requirements file

  1. $ pip3 freeze > requirements.txt

Create the django project

  1. $ django-admin startproject <project-name> .

Create the first app

  1. $ python3 manage.py startapp <app-name>

Run the Server

  1. $ python3 manage.py runserver

The migrate command is used to update the database schema

  1. $ python3 manage.py migrate

Create migration files for all Models that have been added or changed since the last migration

  1. $ python3 manage.py makemigrations

A super user is an administrator for the site. When you are logged in to this account, you can access the Admin app to add additional users and manipulate Model data.

  1. $ python3 manage.py createsuperuser

Change your password

  1. python3 manage.py changepassword <user_name>