推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
ifoolish
V2EX  ›  Python

Django ORM 实现能否实现在第一次打开页面时才配置数据库?

  •  
  •   ifoolish · May 3, 2017 · 2589 views
    This topic created in 3445 days ago, the information mentioned may be changed or developed.

    例如两个主机上的 MySQL 配置了主主同步,数据表均已建好,但事先并不知道用户要用哪个库,第一次打开页面时要让用户填写数据库的 IP 并保存使用。Django 在使用 ORM 的情况下要如何实现?

    2 replies  •  2017-05-04 11:06:39 +08:00
    Victor215
        1
    Victor215  
       May 3, 2017 via Android
    用另外一个服务来配置这个服务
    ryanking8215
        2
    ryanking8215  
       May 4, 2017
    @ifoolish django orm 可以设置多个 DB,也可以动态增加 DB,通过 DBRouter 来控制访问。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   948 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 19:15 · PVG 03:15 · LAX 12:15 · JFK 15:15
    ♥ Do have faith in what you're doing.