最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

django框架創(chuàng)建應用操作示例

 更新時間:2019年09月26日 09:15:45   作者:zhaoyangjian724  
這篇文章主要介紹了django框架創(chuàng)建應用操作,結合實例形式分析了Django框架的安裝、創(chuàng)建項目、創(chuàng)建數據庫及創(chuàng)建應用相關操作技巧,需要的朋友可以參考下

本文實例講述了django框架創(chuàng)建應用操作。分享給大家供大家參考,具體如下:

18.1.5  安裝Django

安裝Django

node2:/root#pip install Django
/usr/local/python27/lib/python2.7/site-packages/cryptography/hazmat/primitives/constant_time.py:26: CryptographyDeprecationWarning: Support for your Python version is deprecated. The next version of cryptography will remove support. Please upgrade to a 2.7.x release that supports hmac.compare_digest as soon as possible.
 utils.DeprecatedIn23,
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/
Requirement already satisfied: Django in /usr/local/python27/lib/python2.7/site-packages (1.11.9)
Requirement already satisfied: pytz in /usr/local/python27/lib/python2.7/site-packages (from Django) (2017.2)
You are using pip version 18.1, however version 19.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

18.1.6  在Django 中創(chuàng)建項目:

node2:/django/mysite#django-admin.py startproject learning_log
node2:/django/mysite#ls -ltr
total 64
-rwxrwxrwx 1 root root 804 Oct 25 2017 manage.py
-rwxrwxrwx 1 root root 608 Nov 25 2017 query_mysql.py
drwxrwxrwx 3 root root 4096 Nov 27 2017 form
drwxrwxrwx 2 root root 4096 Nov 27 2017 online
-rwxrwxrwx 1 root root 262 Dec 5 2017 test.py
-rwxrwxrwx 1 root root 646 Dec 5 2017 test.pyc
-rwxrwxrwx 1 root root 113 Dec 5 2017 __init__.pyc
drwxrwxrwx 2 root root 4096 Dec 5 2017 home
-rwxrwxrwx 1 root root  0 Dec 5 2017 __init__.py
-rwxrwxrwx 1 root root  27 Dec 5 2017 a1.py
-rwxrwxrwx 1 root root  5 Dec 5 2017 celerybeat.pid
drwxrwxrwx 7 root root 4096 Dec 12 2017 static
drwxrwxrwx 4 root root 4096 Jan 28 2018 blog
drwxrwxrwx 2 root root 4096 Sep 16 2018 portal
drwxrwxrwx 2 root root 4096 Apr 24 10:15 mysite
drwxrwxrwx 4 root root 4096 Apr 25 02:17 news
drwxr-xr-x 3 root root 4096 Apr 25 09:25 learning_log

/django/mysite/learning_log/learning_log

INSTALLED_APPS = (
  'django.contrib.admin',
  'django.contrib.auth',
  'django.contrib.contenttypes',
  'django.contrib.sessions',
  'django.contrib.messages',
  'django.contrib.staticfiles',
  'learning_log',

18.1.7 創(chuàng)建數據庫

Django 將大部分與項目相關的信息都存儲在數據庫中,因此我們需要創(chuàng)建一個供Django使用的數據庫

配置mysql數據庫

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'tlcb',
'USER': 'root',
'PASSWORD': '1234567',
'HOST': '192.168.137.3',
'PORT': '3306',
}
}

node2:/django/mysite/learning_log#python manage.py migrate
Operations to perform:
 Apply all migrations: admin, auth, contenttypes, sessions
Running migrations:
 Applying contenttypes.0001_initial... OK
 Applying auth.0001_initial... OK
 Applying admin.0001_initial... OK
 Applying admin.0002_logentry_remove_auto_add... OK
 Applying contenttypes.0002_remove_content_type_name... OK
 Applying auth.0002_alter_permission_name_max_length... OK
 Applying auth.0003_alter_user_email_max_length... OK
 Applying auth.0004_alter_user_username_opts... OK
 Applying auth.0005_alter_user_last_login_null... OK
 Applying auth.0006_require_contenttypes_0002... OK
 Applying auth.0007_alter_validators_add_error_messages... OK
 Applying auth.0008_alter_user_username_max_length... OK
 Applying sessions.0001_initial... OK
node2:/django/mysite/learning_log#

18.1.8 創(chuàng)建應用:

django-admin.py startproject learning_log

希望本文所述對大家基于Django框架的Python程序設計有所幫助。

相關文章

  • python 批量將PPT導出成圖片集的案例

    python 批量將PPT導出成圖片集的案例

    這篇文章主要介紹了python 批量將PPT導出成圖片集的案例,具有很好的參考價值,希望對大家有所幫助。一起跟隨小編過來看看吧
    2021-03-03
  • python如何將數據輸出到文件中

    python如何將數據輸出到文件中

    這篇文章主要介紹了python如何將數據輸出到文件中問題,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教
    2024-01-01
  • Python正則表達式中的'r'用法總結

    Python正則表達式中的'r'用法總結

    正則表達式即使用一個字符串來描述、匹配一系列某個語法規(guī)則的字符串,python中r作用是除去''里面轉意字符,在pyhton自動化中比較常用的,下面這篇文章主要給大家介紹了關于Python正則表達式中的'r'用法總結的相關資料,需要的朋友可以參考下
    2023-04-04
  • 使用Pandas和Matplotlib進行數據清洗與可視化的實現步驟

    使用Pandas和Matplotlib進行數據清洗與可視化的實現步驟

    在數據科學領域,數據清洗和可視化是構建數據驅動解決方案的重要步驟,本文將詳細介紹如何使用Pandas進行數據清洗,并結合Matplotlib進行可視化,文章通過實際代碼示例講解的非常詳細,需要的朋友可以參考下
    2024-08-08
  • python生成詞云的實現方法(推薦)

    python生成詞云的實現方法(推薦)

    下面小編就為大家?guī)硪黄猵ython生成詞云的實現方法(推薦)。小編覺得挺不錯的,現在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-06-06
  • python3在各種服務器環(huán)境中安裝配置過程

    python3在各種服務器環(huán)境中安裝配置過程

    這篇文章主要介紹了python3在各種服務器環(huán)境中安裝配置過程,源碼包編譯安裝步驟詳解,本文通過圖文并茂的形式給大家介紹的非常詳細,需要的朋友可以參考下
    2022-01-01
  • pandas探索你的數據實現可視化示例詳解

    pandas探索你的數據實現可視化示例詳解

    這篇文章主要為大家介紹了pandas探索你的數據實現可視化示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進步,早日升職加薪
    2023-10-10
  • 使用Django實現文章與多個標簽關聯的示例詳解

    使用Django實現文章與多個標簽關聯的示例詳解

    在構建一個博客或內容管理系統(tǒng)時,經常需要實現文章與標簽的關聯,在 Django 中,我們可以利用 ManyToManyField 來實現文章與標簽的多對多關系,在本文中,我們將詳細探討如何使用 Django 模型實現文章與多個標簽的關聯,需要的朋友可以參考下
    2023-11-11
  • zbar解碼二維碼和條形碼示例

    zbar解碼二維碼和條形碼示例

    這篇文章主要介紹了zbar解碼二維碼和條形碼示例,需要的朋友可以參考下
    2014-02-02
  • Python+radar實現隨機日期時間的生成

    Python+radar實現隨機日期時間的生成

    Python有廣泛豐富的第三方庫,在沒有特殊定制下,避免了重復造輪子。本文將利用radar庫實現生成隨機的日期或時間,文中的示例代碼講解詳細,感興趣的可以了解一下
    2022-05-05

最新評論

阳山县| 开鲁县| 兴山县| 景洪市| 抚顺县| 永寿县| 亚东县| 嘉祥县| 郎溪县| 遵化市| 平远县| 霍州市| 石门县| 廊坊市| 德安县| 新宁县| 阿合奇县| 长顺县| 沛县| 砚山县| 毕节市| 乌鲁木齐县| 方城县| 红安县| 米林县| 杭锦旗| 改则县| 吉安市| 龙门县| 大丰市| 祁门县| 余江县| 昌图县| 樟树市| 保亭| 安西县| 辉县市| 锦屏县| 宿迁市| 昭苏县| 西林县|