카테고리 없음
til 2024.05.17(drf 시작 ,설정, 장고시드, 슈퍼유저)
dini_dini
2024. 5. 17. 16:24
깃허브 - 새로운 리포지터리
깃 이그노어 추가
터미널
python -m venv venv
source venv/Scripts/activate
pip install django==4.2
django-admin startproject PROJECT
cd PROJECT
python manage.py startapp accounts
python manage.py startapp articles
pip install djangorestframework
cd ..
pip freeze > requirments.txt
[drf 설정추가]
settings.py
INSTALLED_ APP
#third-party
'rest_framework'
#local
'accounts'
'articles'
=========
데이터 생성하기
터미널
pip install django-seed
pip install psycopg2
setting.py
"django_seed",
python manage.py seed articles --number=30
============
터미널
python manage.py createsuperuser
아이디
이메일
비밀번로 - 입력해도 **등으로 보이거나 하지 않음
main/urls.py
path("admin/", admin.site.urls),추가
http://127.0.0.1:8000/admin 접속 - >로그인하면 관리자 권한으로 접속수 있다.