from django.http import HttpResponse
def index(request):
return HttpResponse('Hello, Django!')
from django.conf.urls.defaults import *
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = patterns('',
# Example:
# (r'^myproj/', include('myproj.foo.urls')),
(r'^$', 'myproj.helloworld.index'),
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
# (r'^admin/', include(admin.site.urls)),
)
Listen 81
NameVirtualHost 127.0.0.1:81
<VirtualHost 127.0.0.1:81>
ServerName localhost:81
<Location "/">
SetHandler python-program
PythonPath "['c:/python25'] + sys.path"
PythonHandler django.core.handlers.modpython
SetEnv DJANGO_SETTINGS_MODULE myproj.settings
PythonInterpreter mysite
PythonAutoReload Off
PythonDebug On
</Location>
</VirtualHost>
from django.contrib import admin from more_with_admin.examples import models class DocumentAdmin(admin.ModelAdmin): pass class CommentAdmin(admin.ModelAdmin): pass admin.site.register(models.Document, DocumentAdmin) admin.site.register(models.Comment, CommentAdmin)
#coding=utf-8
#import os
#os.environ['DJANGO_SETTINGS_MODULE'] = 'myproj.settings'
from django.conf import settings
settings.configure(
DATABASE_ENGINE='mysql',
DATABASE_NAME='django_demo',
DATABASE_USER='root',
DATABASE_PASSWORD='',
DATABASE_HOST='localhost',
DATABASE_PORT='',
)
import db
from django.db import connection
cursor = connection.cursor ()
cursor.execute ("SELECT VERSION()")
row = cursor.fetchone ()
print "server version:", row[0]
cursor.execute ("SELECT * from django_site")
row1 = cursor.fetchall ()
print row1
cursor.close ()
connection.close ()
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有