使用pycharm搭建django项目
file-new project,选中项目的路径,点击create创建,前提是pycharm安装了django的依赖
刚创建的目录结构
cmd命令行进到相对应的路径E:\Python\python_learning\djangoTest2
执行命令
python manage.py startapp django_demo
会生成一个文件夹,我称为之为一个应用
去这个应用的views.py中编写代码,
并去templates文件夹建立相对应的html文件
编写好html和代码之后去urls.py配置文件中配置相对应的路径
配置好之后运行
python manage.py runserver localhost:8080 localhost是ip
运行之后去浏览器访问 localhost:8080就可以看到index.html的内容了