1.urls.PY分离 # -*- coding: UTF-8 -*- from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('blog.views', # Examples: # url(r…
1.配置urls.py from django.conf.urls import patterns, include, url #Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('', # Uncomment the admin/doc line below to enable admin d…
修改urls.PY文件 # -*- coding: UTF-8 -*- from django.conf.urls import patterns, include, url # Uncomment the next two lines to enable the admin: from django.contrib import admin admin.autodiscover() urlpatterns = patterns('blog.views', # Uncomment the adm…
<build> <plugins> <plugin> <artifactId>maven-shade-plugin</artifactId> <configuration> <createDependencyReducedPom>false</createDependencyReducedPom> </configuration> <executions> <execution&g…
1.开始一个项目: 进入创建的目录,然后: django-admin startproject myblog 2.启动开发服务器: python manage.py runserver 注:默认是8000端口,可以改,比如: python manage.py runserver 8001 3.一个视图就是Python的一个函数.这个函数第一个参数的类型是HttpRequest:它返回一个HttpResponse实例.为了使一个Python的函数成为一个Django可识别的视图,它一般必须满足这两…
Django基础 框架,即framework,特指为解决一个开放性问题而设计的具有一定约束性的支撑结构,使用框架可以帮你快速开发特定的系统,简单地说,就是你用别人搭建好的舞台来做表演. 对于所有的Web应用,本质上其实就是一个socket服务端,用户的浏览器其实就是一个socket客户端. WSGI:Web Server Gateway Interface Django准备 下载 ------------------------------------------------ cmd --> p…
百度云盘:django之创建第12个项目-加载图片 1.setting配置 #静态文件相关配置 # URL prefix for static files. # Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/static/' import os BASE_DIR = os.path.dirname(os.path.dirname(__file__)…
目的:将如下众多html页面整合到一个index.html页面中. 百度云盘:django之创建第11个项目-页面整合 用下面的方式实现: <!DOCTYPE html> <head> <meta charset="UTF-8"> <title>站点主页</title> <!--去掉超链接中的下划线--> <style>a{TEXT-DECORATION:none}</style> <…
1.百度云盘:django之创建第10-1个项目-图片上传并记录上传时间 2.主要修改的配置文件有3个,forms.views和models3个文件以及html 3.forms.py文件修改 #coding:utf-8 #这里定义html页面中用到的表单,常和views和models文件配合使用 """ >>> help(django) Help on package django: PACKAGE CONTENTS conf (package) contr…
1.upload.HTMl <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>图片上传功能</titl…