How do I update Django on Openshift?

后端 未结 2 1655
清酒与你
清酒与你 2021-01-28 15:31

I\'m learning to deploy Django on Openshift. Right now I have a python-2.7 cartridge up and running with Django 1.6 The git repo cloned in the cartridge is,

git://github

相关标签:
2条回答
  • 2021-01-28 16:02

    Warnings!

    • make sure new version is ok for your app. Django 1.7 brought DB migrations feature, which might break your compatibility. (We had some issues as we used South before that.)
    • before applying upgrade backup the app instance snapshot (takes time)

    Actually git push takes some time while your application will be down. If you want to shorten the time, you can follow this approach:

    ssh into your app openshift server

    pip install --upgrade Django==<new version>
    

    That will upgrade django immediately. However the running web process still keeps the older version. So you need to restart python cartridge.

    From you local command line:

    rhc cartridge restart -a <your app> -c python
    

    Now its running with the new django and the downtime is minimal.

    Make sure to update setup.py as mentioned in the other answer in order to be aligned with the next git push.

    0 讨论(0)
  • 2021-01-28 16:11

    The easiest way to achieve this is to change the setup dependencies (install_requires parameter for setup ()) in setup.py. Instead of

    packages = ['Django<=1.6',]
    

    as in the cartridge default you could write

    packages = ['Django>=1.7,<1.8',]
    

    to get the latest version of Django 1.7. More details of how to specify values can be found in the Python Packaging User Guide.

    With your next git push this file will be executed and the packages get updated, if required.

    0 讨论(0)
提交回复
热议问题