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的內容了