Create a project
django-admin startproject myproject
Create virtual environment
cd myproject
py -m venv env
.\env\Scripts\activate
Install django
pip install django
Start up an app
python manage.py startapp book
Add schema to models.py
Modify settings.py under project
Add "book" to INSTALLED_APPS
Apply model schema
python manage.py makemigrations
python manage.py migrate
Register models in admin.py
from .models import Book admin.site.register(Book)
python manage.py runserver
No comments:
Post a Comment