Giter Club home page Giter Club logo

django-nudge's Introduction

Nudge is a Django app that lets you selectively push content from one Django server (we'll call this "staging") to another ("production").

When staging code, you might find it necessary to preview that code with real data. You might also use your staging-side Django admin as your primary content creation environment, in order to beef up security on your production end.

If you do either of these, moving content from staging to production requires copying your entire database from one server to another. Nudge fixes this. Nudge will let you move new and modified content from staging to production. As content is created, deleted, and modified in staging, Nudge will keep track of it. When you are ready to move that content to production, create a batch. Add whatever content necessary to that batch; ignore the content that is not yet ready to be sent to production. Save the batch and deploy it. The content in the batch will be immediately available in your production environment.

Nudge was inspired by the RAMP plugin for WordPress and wouldn't be possible without the incredible django-reversion version control extension.

You should understand how Reversion works before proceeding with nudge, and any models you'll want to use with Nudge should be enabled for Reversion.

https://github.com/etianen/django-reversion

Installation

  1. Install nudge with 'pip install django-nudge'
  2. add 'nudge' to your INSTALLED_APPS
  3. add nudge to your URL configuration, on your both servers: like: url(r'^nudge-api/', include('nudge.urls')),
  4. run manage.py syncdb

Using Nudge

  1. Use your favorite method of enabling django-reversion for your models.
  2. generate a key by running ./manage.py new_nudge_key. Set this to NUDGE_KEY in both settings.py (staging and production)
  3. in the staging settings.py, set NUDGE_REMOTE_ADDRESS to the 'nudge-api' URL of your production server 'http://somehost/nudge-api/'
  4. in the staging settings.py, set NUDGE_SELECTIVE to a list any models that you want to use with Nudge (and are already being managed by reversion), like ['jobmanager.job', 'knowledgebase.question']

django-nudge's People

Contributors

atbaker avatar cmc333333 avatar dlapiduz avatar jroo avatar rosskarchner avatar virtix avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

django-nudge's Issues

settings assume pk=1

find a better way. don't rely on id, maybe enforce that only one setting record exists? possibly move settings out of database and into a file?

process_batch wreaks havoc on postgres sequences

Loading a batch sets PKs on the imported models. For some reason this doesn't update the auto increment sequence used to automatically set PKs on newly created instances (I think this might be postgres only). I've borrowed some code from Django's 1.4 loaddata command to remedy this:

https://github.com/EightMedia/django-nudge/commit/a58c3e61909086566e4d5da4ebeed464c0bf0067

Can't currently do a pull request as I'm working in branch that has my PEP8 cleanup branch applied.

Tests are broken

The tests currently are broken. They import non existing names:

from nudge.client import serialize_batch
from nudge.management.commands import nudgeinit

Seems the tests haven't been updated to test recent refactor efforts.

Remove unused settings

Per conversation with @rosskarchner and @Burton, Local Address is unused and local key/remote key is confusing. We should clean up the settings page and have it make more sense to the user.

can't undo many-to-many relationships

Scenario:

  • A model "Jobs" with a many to many relationships to "JobType"
  • Add a job related to jobtypes A,B,C
  • Nudge it
  • Remove the relationship between the job and B, and add a relationship to D
  • Nudge the changes
  • On staging, the job will be related to A,C, and D
  • On production, the job will be related to A, B, C, and D

Add test button to settings admin view

It would be nice to have a "Test Settings" button on the settings page that encrypts a dummy batch, sends it to the server and is notified of success or failure.

Kill obsolete management commands

eligible_to_batch and eligible_to_push were used before we had an admin interface. They're no longer needed and were never intended to be part of the release.

Bi-directional sync

Nudge gently moves newly staged content to production. What about moving user-generated content from production to staging? Is "Coax" a possibility for v2?

Flesh out exceptions

Exceptions will exist everywhere. Let's think through these, where to throw them and how they will be represented by a server response.

Implement table synchronization

Batch pushing is a nice idea, but it kind of falls down with highly relational models. Admins should be able to specify groups of tables (or whole apps) and a directionality (push or pull), and allow users to execute those actions on demand.

dependencies

Capturing a thought: it's possible for items to depend on others (on Crick, for example, questions have related items).

How do we deal with that? We may need the ability to define behaviors on a model-by-model (or relationship-by-relationship) way.

What's the use of batch.start_date

The batch class has a field called "start_date" but I can't figure out what it's used for.

It defaults to date.today since that's what "default_batch_start_date" returns.

The comment of "default_batch_start_date" suggests that it should default to "date last completed batch pushed or date of earliest revision or today".

I can't find any method that uses this date field.

nudgeinit breaks on when reversion and data are out of sync

Expected behavior, but could be problematic for users.

'''
File/nudge/utils.py", line 14, in latest_objects
latest_obj=get_for_object(o)[0]
File "/usr/local/lib/python2.6/dist-packages/reversion/revisions.py", line 503, in get_for_object
return self.get_for_object_reference(obj.class, obj.pk)
AttributeError: 'NoneType' object has no attribute 'pk'
'''

better key management

Proposed flow:

  • By default, local and remote keys are obscured
  • User can check a box, indicating that they accept the risk that comes with keys being displayed. Explanation also includes an alternate, safer (command-line driven) process for viewing and updating keys
  • if box is checked and form submitted, user can:
    • edit the remote key
    • see (but not edit) the local key.
    • click a button to generate a new local key

Choose a license

There are other countries out there that have no meaning for "public domain" as a software licensing model. Please choose an Open Source license. Github has this nifty license selector now: http://choosealicense.com

Create test batch

Create dummy batch to test if dev and production are communicating.

Nudging files

As far as I can figure out it seems impossible to update files using nudge. With that I mean that models containing files get synced correctly, but the actual files do not get synced, resulting in missing files on the production environment.

Any plans/ideas on how to fix this?

Implement working copies

If we're syncing whole tables (see issue #60 ), we need to implement some sort of working copy support, so that editors can have pending versions of already-published content.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.