zoukankan      html  css  js  c++  java
  • How to import Django DB operations out of Django projects

    i am not familiar with DB opertions. usually i stroe data to txt and other formats. as DB is more and more popular, i want to try it too.

    i have some knowledge about Django. the DB opertions in Django is very easy than the DB source code. so i decided to reuse the Django DB operations out of Django projects.

    it is very useful for small progress.

    import os,sys
    sys.path.append('Django project path')
    os.environ['DJANGO_SETTINGS_MODULE']='settings'
    from .views import viewClasses
    import django
    django.setup()

    All right, we can reuse the Django DB operations for the 'viewClasses' now.

    it is practical for basic DB operations like Add / Delete / Update / Retrieve

    Hope it can help you.

  • 相关阅读:
    点分治
    主席树
    可持久化并查集
    可持久化线段树
    网络流
    AC自动机
    线性基
    快速幂
    素数筛
    扩展欧几里得算法
  • 原文地址:https://www.cnblogs.com/frost-hit/p/6727574.html
Copyright © 2011-2022 走看看