码迷,mamicode.com
首页 > 其他好文 > 详细

django-orm-standalone

时间:2016-09-27 17:37:51      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

django-orm-standalone script

via:https://github.com/masnun/django-orm-standalone/

 

# Django specific settings
import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings")

# Ensure settings are read
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

# Your application specific imports
from data.models import *


#Add user
user = User(name="masnun", email="masnun@gmail.com")
user.save()

# Application logic
first_user = User.objects.all()[0]

print(first_user.name)
print(first_user.email)

 

django-orm-standalone

标签:

原文地址:http://www.cnblogs.com/yaohan/p/5913507.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!