python写订单管理系统_订单系统(django+python+dwz)⼀.运⾏zt框架
1.安装JPype-0.5.4.win32-py
simplejson-2.1.1.
显⽰0 error 。
⼆.订单管理搭建
django admin 自定义页面1.在zt/urls.py中添加
url(r'^b120910ordermanagement/', include('zt.a120910ordermanagement.urls')),
2.setting.py 的DATABASES = {}中添加数据库连接代码
'order': {
'ENGINE': 'django.sql', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
'OPTIONS': {'use_unicode':'true',#'characterEncoding':'utf8',
#'zeroDateTimeBehavior':'round',
} ,
'NAME': r'order', # Or path to database file if using sqlite3.
'USER': 'fresh', # Not used with sqlite3.
'PASSWORD': '0123456789', # Not used with sqlite3.
'HOST': '192.168.0.97', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '3306',
}
3.在zt/a120910ordermanagement⽬录下创建 __init__.py urls.py view.py model.py⽂件
#---view.py:-------#
# -*- coding: utf-8 -*-
from dels import *
sponse import TemplateResponse
#全局变量
content_type = "text/html;charset=utf-8"
def index(request):
return TemplateResponse(request, "a120910ordermanagement/index.html", None, content_type)
#---urls.py:-------#
'''
Created on 2012-9-10
@author: yang.wang
'''
f.urls.defaults import *
from zt.a120910ordermanagement.views import *
urlpatterns = patterns('',
url(r'^$', index),
)
#---model.py:-------#
# This is an auto-generated Django model module.
# You'll have to do the following manually to clean this up:
# * Rearrange models' order
# * Make sure each model has one field with primary_key=True
# Feel free to rename the models, but don't rename db_table values or field names.
#
# Also note: You'll have to insert the output of 'django-admin.py sqlcustom [appname]'
# into your database.
from django.db import models
class Team(models.Model):
id = models.IntegerField(primary_key=True, db_column='ID') # Field name made lowercase.
name = models.CharField(max_length=96, unique=True, db_column='NAME') # Field name made lowercase.
created_date = models.DateTimeField(db_column='CREATED_DATE') # Field name made lowercase.
status = models.IntegerField(null=True, db_column='STATUS', blank=True) # Field name made lowe
rcase.
class Meta:
db_table = u'TEAM'
def __unicode__(self):
return self.name
class TeamHistory(models.Model):
order_number = models.IntegerField(primary_key=True, db_column='ORDER_NUMBER') # Field name made lowercase. team = models.ForeignKey(Team, db_column='TEAM_ID') # Field name made lowercase.
consumption = models.FloatField(null=True, db_column='CONSUMPTION', blank=True) # Field name made lowercase. comment = models.CharField(max_length=300, db_column='COMMENT', blank=True) # Field name made lowercase. created_date = models.DateTimeField(db_column='CREATED_DATE') # Field name made lowercase.
status = models.IntegerField(null=True, db_column='STATUS', blank=True) # Field name made lowercase.
class Meta:
db_table = u'TEAM_HISTORY'
def __unicode__(self):
return self.name
class User(models.Model):
id = models.IntegerField(primary_key=True, db_column='ID') # Field name made lowercase.
name = models.CharField(max_length=96, unique=True, db_column='NAME') # Field name made lowercase.
password = models.CharField(max_length=96, db_column='PASSWORD') # Field name made lowercase.
authority = models.IntegerField(null=True, db_column='AUTHORITY', blank=True) # Field name made lowercase. comment = models.CharField(max_length=300, db_column='COMMENT', blank=True) # Field name made lowercase. email = models.CharField(max_length=96, db_column='EMAIL', blank=True) # Field name made lowercase.
created_date = models.DateTimeField(db_column='CREATED_DATE') # Field name made lowercase.
status = models.IntegerField(null=True, db_column='STATUS', blank=True) # Field name made lowercase.
class Meta:
db_table = u'USER'
def __unicode__(self):
return self.name
class UserChargeHistory(models.Model):
id = models.IntegerField(primary_key=True, db_column='ID') # Field name made lowercase.
user = models.ForeignKey(User, db_column='USER_ID') # Field name made lowercase.
team = models.ForeignKey(Team, db_column='TEAM_ID') # Field name made lowercase.
charge = models.FloatField(null=True, db_column='CHARGE', blank=True) # Field name made lowercase.
created_date = models.DateTimeField(db_column='CREATED_DATE') # Field name made lowercase.
status = models.IntegerField(null=True, db_column='STATUS', blank=True) # Field name made lowercase.
class Meta:
db_table = u'USER_CHARGE_HISTORY'
def __unicode__(self):
return self.name
class UserHistory(models.Model):
team_history_order_number = models.ForeignKey(TeamHistory, primary_key=True,
db_column='TEAM_HISTORY_ORDER_NUMBER') # Field name made lowercase.
user = models.ForeignKey(User, db_column='USER_ID') # Field name made lowercase.
consumption = models.FloatField(null=True, db_column='CONSUMPTION', blank=True) # Field name made lowercase. created_date = models.DateTimeField(db_column='CREATED_DATE') # Field name made lowercase.
status = models.IntegerField(null=True, db_column='STATUS', blank=True) # Field name made lowercase.
class Meta:
db_table = u'USER_HISTORY'
def __unicode__(self):
return self.name
class UserTeam(models.Model):
id = models.IntegerField(primary_key=True, db_column='ID') # Field name made lowercase.
user = models.ForeignKey(User, db_column='USER_ID') # Field name made lowercase.
team = models.ForeignKey(Team, db_column='TEAM_ID') # Field name made lowercase.
balance = models.FloatField(null=True, db_column='BALANCE', blank=True) # Field name made lowercase. flag = models.IntegerField(null=True, db_column='FLAG', blank=True) # Field name made lowercase. created_date = models.DateTimeField(db_column='CREATED_DATE') # Field name made lowercase.
status = models.IntegerField(null=True, db_column='STATUS', blank=True) # Field name made lowercase. class Meta:
db_table = u'USER_TEAM'
def __unicode__(self):
return self.name
4.在zt/templates/b120910ordermanagement/下创建 index.html
wangyang hello world
5.浏览器⾥访问⽹址 127.0.0.1:8000/b120910ordermanagement可得到如下页⾯
就此框架成功。

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。