Python 環境搭建到項目初試

win環境………………html

環境參考python

https://www.zhihu.com/question/58033789django

項目參考瀏覽器

https://blog.csdn.net/qq_28304687/article/details/53507223?locationNum=5&fps=1session

框架選擇參考app

https://www.cnblogs.com/linkenpark/p/5881586.html框架

 

這裏開始是親自操做(因爲環境以前搭建,無圖、無說明,只有項目)ide

一、查看已安裝測試

conda listui

我這裏須要 Django 搭建項目,因此須要安裝(存在就不安裝了……)

安裝命令:conda install Django

再次     conda list     確認安裝成功

二、導入        import django

三、建立項目

若是想指定項目文件夾,

cd pythonProj

運行命令建立    (psytest我用的測試項目名,這個本身定義)

django-admin startproject psytest

而後能夠在對應的文件夾能夠看到新增  psytest 文件夾   (建議開啓文件後綴名…………)

  psytest 文件夾  中 能夠看到    psytest 文件夾以及 manage.py

四、運行(個人80端口有其餘項目)

我嘗試了

python manage.py runserver 127.0.0.2

但是報錯了,錯誤以下(截圖麻煩,只放文字)

CommandError: "127.0.0.2" is not a valid port number or address:port pair.

因此加了端口

 python manage.py runserver 127.0.0.1:8080

 

命令執行後,結果

Performing system checks...

System check identified no issues (0 silenced).

You have 13 unapplied migration(s). Your project may not work properly until you
 apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
July 23, 2018 - 11:22:49
Django version 1.11.3, using settings 'psytest.settings'
Starting development server at http://127.0.0.1:8080/
Quit the server with CTRL-BREAK.

 

瀏覽器輸入  http://127.0.0.1:8080/

It worked!

Congratulations on your first Django-powered page.

至此,只是環境加框架能夠運行,離項目開發還不知道…………

相關文章
相關標籤/搜索