• Web Development with Python Step1


    Step1 - Project Setup & Flask Basics

    1.Create a project on GitHub

    2.Open up the project on Replit and Vscode

    Sign Up - Replit

     click save

    3.Create and run a Flask web server

     

    1. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % pwd
    2. /Users/maxwellpan/selflearn/maxwell-careers-website
    3. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % ls -ltr
    4. total 24
    5. -rw-r--r-- 1 maxwellpan staff 1066 Apr 24 09:41 LICENSE
    6. -rw-r--r-- 1 maxwellpan staff 67 Apr 24 09:41 README.md
    7. -rw-r--r-- 1 maxwellpan staff 20 Apr 24 09:41 app.py
    8. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % python3 -m venv .venv
    9. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % . .venv/bin/activate
    10. (.venv) maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % pip3 install Flask
    11. Collecting Flask
    12. Using cached flask-3.0.3-py3-none-any.whl.metadata (3.2 kB)
    13. Collecting Werkzeug>=3.0.0 (from Flask)
    14. Using cached werkzeug-3.0.2-py3-none-any.whl.metadata (4.1 kB)
    15. Collecting Jinja2>=3.1.2 (from Flask)
    16. Using cached Jinja2-3.1.3-py3-none-any.whl.metadata (3.3 kB)
    17. Collecting itsdangerous>=2.1.2 (from Flask)
    18. Using cached itsdangerous-2.2.0-py3-none-any.whl.metadata (1.9 kB)
    19. Collecting click>=8.1.3 (from Flask)
    20. Using cached click-8.1.7-py3-none-any.whl.metadata (3.0 kB)
    21. Collecting blinker>=1.6.2 (from Flask)
    22. Using cached blinker-1.7.0-py3-none-any.whl.metadata (1.9 kB)
    23. Collecting MarkupSafe>=2.0 (from Jinja2>=3.1.2->Flask)
    24. Using cached MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl.metadata (3.0 kB)
    25. Using cached flask-3.0.3-py3-none-any.whl (101 kB)
    26. Using cached blinker-1.7.0-py3-none-any.whl (13 kB)
    27. Using cached click-8.1.7-py3-none-any.whl (97 kB)
    28. Using cached itsdangerous-2.2.0-py3-none-any.whl (16 kB)
    29. Using cached Jinja2-3.1.3-py3-none-any.whl (133 kB)
    30. Using cached werkzeug-3.0.2-py3-none-any.whl (226 kB)
    31. Using cached MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl (18 kB)
    32. Installing collected packages: MarkupSafe, itsdangerous, click, blinker, Werkzeug, Jinja2, Flask
    33. Successfully installed Flask-3.0.3 Jinja2-3.1.3 MarkupSafe-2.1.5 Werkzeug-3.0.2 blinker-1.7.0 click-8.1.7 itsdangerous-2.2.0
    34. (.venv) maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website %

    4.Push changes back to GitHub

    1. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % git init
    2. Reinitialized existing Git repository in /Users/maxwellpan/selflearn/maxwell-careers-website/.git/
    3. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % git add .
    4. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % git status
    5. On branch main
    6. Your branch is up to date with 'origin/main'.
    7. Changes to be committed:
    8. (use "git restore --staged ..." to unstage)
    9. new file: test.py
    10. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % git commit -m "just add a test.py for testing"
    11. [main 1e9ee1d] just add a test.py for testing
    12. 1 file changed, 1 insertion(+)
    13. create mode 100644 test.py
    14. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % git remote add origin https://github.com/psmaxwell/maxwell-careers-website.git
    15. error: remote origin already exists.
    16. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website % git push -u origin main
    17. Enumerating objects: 4, done.
    18. Counting objects: 100% (4/4), done.
    19. Delta compression using up to 8 threads
    20. Compressing objects: 100% (2/2), done.
    21. Writing objects: 100% (3/3), 301 bytes | 301.00 KiB/s, done.
    22. Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
    23. remote: Resolving deltas: 100% (1/1), completed with 1 local object.
    24. To https://github.com/psmaxwell/maxwell-careers-website.git
    25. d428d5f..1e9ee1d main -> main
    26. branch 'main' set up to track 'origin/main'.
    27. maxwellpan@maxwellpans-MacBook-Pro maxwell-careers-website %

     

    FYI:GitHub - psmaxwell/maxwell-careers-website: a career for web development with python

  • 相关阅读:
    .NET周报【10月第3期 2022-10-25】
    石墨烯-壳聚糖-1-乙基-3-甲基咪唑四氟硼酸盐([BMIM])复合材料(Graphene-Chits-[BMIM])
    iOS 使用陀螺仪实现裸眼3d效果
    【VulnHub靶场】Hackable: III
    流量控制&可靠传输机制&停止-等待协议
    新手学习笔记-----编译和链接
    PyTorch的简介和安装
    elmenetui表格二次封装包含查询框和分页
    Linux·设备
    【Spring】实例化bean的三种方式、bean的生命周期控制操作(代码解释)
  • 原文地址:https://blog.csdn.net/u011868279/article/details/138143968