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
基本配置 为了探究nginx的url配置规则,当然需要安装nginx.我使用了vagrant创建了一个虚拟环境的ubuntu,通过apt-get安装nginx.这样就不会污染mac的软件环境.通过vragrant再创建一个项目进行实验.如果不了解vagrant的使用,可以查看Vagrant 虚拟环境利器. /vagrant目录下创建了一个pro用于项目的根目录,同时配置nginx的配置文件(/etc/nginx/sites-enabled/pro.conf) ☁ pro tree . ├── 4
1.在创建项目时,Django会自动创建URL配置,在urls.py文件中 文件的默认内容如下所示: """mysite URL Configuration The urlpatterns list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.8/topics/http/urls/ Examples: Function views 1. A