Code in views.py:
def show_all_user (req):
Num=1
If ' Pagenum ' in req. POST:
Num=req. post[' Pagenum ']
Tlist=user.objects.all ()
P=paginator (tlist,30)
Page=p.page (num)
Return Render_to_response (' show_all_user.html ', {' All_user ':p age.object_list, ' pagenum ': num, ' total ': Range (1,p.num _PAGES+1)})
settings.py
Import OS
Base_dir = Os.path.dirname (Os.path.dirname (__file__))
Template_dirs = (
Os.path.join (Os.path.dirname (__file__), '. /templates '). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /activitypush/templates/'). replace (' \ \ ', '/'),
# Os.path.join (Os.path.dirname (__file__), ' ... /activitypush/js/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /mysite/templates/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /upload/templates/'). replace (' \ \ ', '/'),
Os.path.dirname (Os.path.dirname (__file__)),
Os.path.join (Os.path.dirname (__file__), '. /activitypush/static/js/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /mysite/templates/'). replace (' \ \ ', '/'),
)
Static_url = '/static/'
Staticfiles_dirs = (
Os.path.join (Os.path.dirname (__file__), '. /static/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /activitypush/static/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /mysite/static/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /clientloading/static/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /upload/static/'). replace (' \ \ ', '/'),
Os.path.join (Os.path.dirname (__file__), '. /myauth/static/'). replace (' \ \ ', '/'),
)
Static_path = Os.path.join (Os.path.dirname (__file__), '. /templates '). replace (' \ \ ', '/')
Secret_key = ' a=is^ $ivb) $s 5$_fq+ (6leza+&2z$= (s-2-*[email protected] #z66j *yu '
# SECURITY Warning:don ' t run with debug turned on production!
DEBUG = True
Template_debug = True
Allowed_hosts = []
site_id = 1
# application Definition
Installed_apps = (
' Django.contrib.admin ',
' Django.contrib.auth ',
' Django.contrib.contenttypes ',
' Django.contrib.sessions ',
' Django.contrib.messages ',
' Django.contrib.staticfiles ',
' Django.contrib.sites ',
' Django.contrib.admindocs '
)
Middleware_classes = (
' Django.contrib.sessions.middleware.SessionMiddleware ',
' Django.middleware.common.CommonMiddleware ',
' Django.middleware.csrf.CsrfViewMiddleware ',
' Django.contrib.auth.middleware.AuthenticationMiddleware ',
' Django.contrib.messages.middleware.MessageMiddleware ',
' Django.middleware.clickjacking.XFrameOptionsMiddleware ',
' Django.core.files.uploadhandler.MemoryFileUploadHandler ',
' Django.core.files.uploadhandler.TemporaryFileUploadHandler ',
)
root_urlconf = ' Mysite.urls '
wsgi_application = ' mysite.wsgi.application '
DATABASES = {
' Default ': {
' ENGINE ': ' Django.db.backends.mysql ',
' NAME ': ' Django ',
' USER ': ' Root ',
' PASSWORD ': ' Root ',
' HOST ': ' localhost ',
' PORT ': ' 3306 ',
}
}
The complete code is: http://download.csdn.net/detail/dxldehuali/8030623
Shop address of Small series, Welcome to visit: http://yunduosuper.taobao.com/
Django Python3 instance MySQL database