21 สิงหาคม 2558

Django + Python




1. Install Python ==3.4.3
2. Download (get-pip.py) ตัว Install แบบอัตโมัติ
- python get-pip.py (install เข้า command)
- pip freeze (ทดสอบ) wheel==0.24.0
3. Install Django
- pip install Djano (version ล่าสุด)
- pip install Djano==1.8.3
4. Create virtual directory ==13.1.0
- pip install virtualenv
- pip freeze
- virtual venv (สร้าง virtual directory)
- cd venv
- .\Scripts\activate (start  virtual enveronment)
- deactivate (ออก)
5. Create Server Project
- (cd path venv) and (.\Scripts\activate)
- python django-admin.py startproject dgadget(ชื่อโปรเจ็ค)
- python manage.py runserver (run website 127.0.0.1:8000) (แสดงหน้าต่างแสดงข้อความยินดี)
- python manage.py syncdb (สร้างฐานข้อมูล admin อัตโนมัติ)
- python manage.py runserver (run website 127.0.0.1:8000/admin) (แสดงหน้าต่างเข้าสู่ระบบ)
- python manage.py startapp blog (สร้าง app)
6. Update Project. modify code
- python manage.py migrations (ทั้ง proj.)
- python manage.py makemigrate app (ปรับปรุง by proj.)
7. Add on 3th (thrid party)
- pip install --upgrade django-crispy-forms   (team form ของ crispy) ==1.4.0
- pip install django-registration-redux   (team form registration ของ django) ==1.2

*********************************************************************************************
Referrence.
https://www.youtube.com/watch?v=QhevHKBy7Hc
https://www.youtube.com/watch?v=Ly9MeQ4N1C8&index=4&list=PLQVvvaa0QuDcTDEowl-b5nQlaDaD82r_s

0 ความคิดเห็น:

แสดงความคิดเห็น