快活林资源网 Design By www.csstdc.com
本文实例讲述了django框架创建应用操作。分享给大家供大家参考,具体如下:
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 中创建项目:
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 创建数据库
Django 将大部分与项目相关的信息都存储在数据库中,因此我们需要创建一个供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 创建应用:
django-admin.py startproject learning_log
希望本文所述对大家基于Django框架的Python程序设计有所帮助。
快活林资源网 Design By www.csstdc.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
快活林资源网 Design By www.csstdc.com
暂无评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新日志
2025年01月09日
2025年01月09日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]