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

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

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

本文實(shí)例講述了django框架創(chuàng)建應(yī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)建項(xià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)建數(shù)據(jù)庫

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

配置mysql數(shù)據(jù)庫

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)建應(yīng)用:

django-admin.py startproject learning_log

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

相關(guān)文章

  • python 批量將PPT導(dǎo)出成圖片集的案例

    python 批量將PPT導(dǎo)出成圖片集的案例

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

    python如何將數(shù)據(jù)輸出到文件中

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

    Python正則表達(dá)式中的'r'用法總結(jié)

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

    使用Pandas和Matplotlib進(jìn)行數(shù)據(jù)清洗與可視化的實(shí)現(xiàn)步驟

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

    python生成詞云的實(shí)現(xiàn)方法(推薦)

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

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

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

    pandas探索你的數(shù)據(jù)實(shí)現(xiàn)可視化示例詳解

    這篇文章主要為大家介紹了pandas探索你的數(shù)據(jù)實(shí)現(xiàn)可視化示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2023-10-10
  • 使用Django實(shí)現(xiàn)文章與多個(gè)標(biāo)簽關(guān)聯(lián)的示例詳解

    使用Django實(shí)現(xiàn)文章與多個(gè)標(biāo)簽關(guān)聯(lián)的示例詳解

    在構(gòu)建一個(gè)博客或內(nèi)容管理系統(tǒng)時(shí),經(jīng)常需要實(shí)現(xiàn)文章與標(biāo)簽的關(guān)聯(lián),在 Django 中,我們可以利用 ManyToManyField 來實(shí)現(xiàn)文章與標(biāo)簽的多對多關(guān)系,在本文中,我們將詳細(xì)探討如何使用 Django 模型實(shí)現(xiàn)文章與多個(gè)標(biāo)簽的關(guān)聯(lián),需要的朋友可以參考下
    2023-11-11
  • zbar解碼二維碼和條形碼示例

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

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

    Python+radar實(shí)現(xiàn)隨機(jī)日期時(shí)間的生成

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

最新評論

江油市| 河间市| 河北区| 甘孜县| 海丰县| 武汉市| 乐亭县| 濉溪县| 福州市| 许昌县| 绿春县| 旬阳县| 马公市| 甘南县| 镇江市| 湾仔区| 金平| 时尚| 县级市| 富民县| 揭阳市| 万载县| 溧水县| 宁蒗| 中卫市| 马关县| 石屏县| 寻乌县| 黔西县| 仙游县| 紫金县| 永济市| 开远市| 玉门市| 错那县| 博客| 林周县| 鹿泉市| 年辖:市辖区| 哈密市| 乐亭县|