标签:
django是mtv框架
models,templates,views
以下是url传递参数样例
http://192.168.10.103:9008/login/?user=alex&passwd=123
easy_install pip pip install django easy_install django 以上两种方法安装的django版本是不一样的 >>> import django >>> django.__version__ ‘1.10rc1‘ django-admin startproject first cd first/first 以下是项目(project)目录结构 [root@103-c7 first]# ll total 28 -rw-rw-r-- 1 root root 0 Jul 21 12:42 __init__.py -rw-r--r-- 1 root root 121 Jul 21 12:47 __init__.pyc -rw-rw-r-- 1 root root 3240 Jul 21 18:49 settings.py -rw-r--r-- 1 root root 2624 Jul 21 18:50 settings.pyc -rw-rw-r-- 1 root root 900 Jul 21 19:38 urls.py -rw-r--r-- 1 root root 1099 Jul 21 19:38 urls.pyc -rw-rw-r-- 1 root root 387 Jul 21 12:42 wsgi.py -rw-r--r-- 1 root root 574 Jul 21 12:48 wsgi.pyc python manage.py startapp blog 以下是应用(app)目录结构 [root@103-c7 first]# cd blog/ [root@103-c7 blog]# ll total 40 -rw-rw-r-- 1 root root 63 Jul 21 12:43 admin.py -rw-r--r-- 1 root root 177 Jul 21 12:47 admin.pyc -rw-rw-r-- 1 root root 124 Jul 21 12:43 apps.py -rw-rw-r-- 1 root root 0 Jul 21 12:43 __init__.py -rw-r--r-- 1 root root 120 Jul 21 12:47 __init__.pyc drwxr-xr-x 2 root root 155 Jul 21 19:15 migrations -rw-rw-r-- 1 root root 261 Jul 21 19:13 models.py -rw-r--r-- 1 root root 598 Jul 21 19:13 models.pyc -rw-rw-r-- 1 root root 60 Jul 21 12:43 tests.py -rw-r--r-- 1 root root 177 Jul 21 18:50 tests.pyc -rw-rw-r-- 1 root root 571 Jul 21 19:53 views.py -rw-r--r-- 1 root root 1128 Jul 21 19:53 views.pyc 先改settings.py,加入应用名即blog INSTALLED_APPS = [ ‘django.contrib.admin‘, ‘django.contrib.auth‘, ‘django.contrib.contenttypes‘, ‘django.contrib.sessions‘, ‘django.contrib.messages‘, ‘django.contrib.staticfiles‘, ‘blog‘, ] 然后就可以启动了 python manage.py runserver 0.0.0.0:9008 &
标签:
原文地址:http://www.cnblogs.com/createyuan/p/5693007.html