django-orm-standalone

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)

 

posted @ 2016-09-27 16:55  hallo.world  阅读(276)  评论(0编辑  收藏  举报