• 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.

  • 相关阅读:
    bzoj1221
    hdu3377
    bzoj3930
    bzoj3976
    bzoj4237
    fzu1977
    hdu1693
    ural1519
    bzoj1264
    回答自己的提问
  • 原文地址:https://www.cnblogs.com/frost-hit/p/6727574.html
Copyright © 2020-2023  润新知