ขั้นตอนแรกจะทำการเช็คว่าได้ติดตั้ง Django และพร้อมจะทำงานหรือยัง สามารถทำได้โดยการใช้Django’s development server
-ทำการสร้างไฟล์ชื่อ functional_tests.py และเขียนcode ดังนี้
code นี้จะทำการเปิด firefox browser
-ทดลอง run code in terminal โดยใช้คำสั่ง python3 functional_tests.py
จะเห็นว่ายังมีerror อยู่เนื่องจากว่ายังไม่ได้รัน server
Getting Django Up and Running
-สร้างโปรเจคใหม่ด้วยคำสั่ง django-admin.py startproject superlists
โดยคำสั่งนี้จำทำการสร้างไฟล์และโฟเดอร์ต่างๆขึ้นมาดังนี้
└── superlists
├── manage.py
└── superlists
├── __init__.py
├── settings.py
├── urls.py
└── wsgi.py
-ทดลองรัน server ที่ cd superlists โดยใช้คำสั่ง python3 manage.py runserver

-เปิด terminal ขึ้นมาอีก1อัน แล้วทำการรันไฟล์ python3 functional_tests.py

Starting a Git Repository
git
เป็นสิ่งที่เรียกว่า version control
เป็นสิ่งที่ดูแลและควบคุมการเปลี่นแปลงของ source code
โดยสิ่งที่เราเอาไปฝากไว้บน git จะถูกเรียกว่า Repository โดยภายใน git ก็จะมีคำสั่งต่างๆอีกมากมายที่ช่วยให้งานของเราปลอดภัยมากยิ่งขึ้น เช่นการ save
ข้อดีของ git คือ มีการกระจายความเสี่ยง โดยเมื่อเราทำการเปลี่ยนแปลง git จะเก็บการเปลี่ยนแปลงไว้ใน Repository
ข้อดีของ git คือ มีการกระจายความเสี่ยง โดยเมื่อเราทำการเปลี่ยนแปลง git จะเก็บการเปลี่ยนแปลงไว้ใน Repository
-ทำการย้ายไฟล์ functional_tests.py ไปไว้ที่ superlists โดยใช้คำสั่ง
mv functional_tests.py superlists/ และทำการย้ายการทำงานไปที่ superlists โดยใช้คำสั่ง
cd superlists
- git init .
-echo "db.sqlite3" >> .gitignore เป็นคำสั่งที่จะทำการยกเว้นการ back up ไฟล์ที่จะ ไว้ในไฟล์ .gitignore // db.sqlite3 is a database file.
-git add .
-git status
remove them from Git and add them to .gitignore.
-git rm -r --cached superlists/__pycache__
-echo "__pycache__" >> .gitignore
-echo "*.pyc" >> .gitignore
-git status
-git add .gitignore
-git commit
พิมหัวข้อดังนี้ "First commit :First FT and basic
Django config”







ไม่มีความคิดเห็น:
แสดงความคิดเห็น