Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a recommended way to deal with deploying pages from local dev to prod?

Tags:

django-cms

For example, say I am working on a FAQ page locally. I create whatever plugins/templates etc I need. Then, locally, I proceed to add the plugins to the page, debug, modify whatever. Now it comes time for me to deploy this to production.

I am left with redoing all the work again, copy/pasting the content and rebuilding the FAQ page or is there an alternative way? Things I have thought of:

  • Create a data migration representing the structure/content

  • Sync the production db to the dev db, make my changes and push it all back during a downtime window.

Are there any other solutions around in the Django CMS community for handling this kind of thing?

The data migration seems like the best approach, but I figured I would ask to be sure I wasn't missing anything.

like image 275
AJ Venturella Avatar asked Oct 02 '17 23:10

AJ Venturella


1 Answers

I am not aware of any out-of-the-box solution to this problem. Data migration seems fine, though if you are planning to integrate it into the actual migrations framework, I would be worried about making it too coupled to the state of the database (i.e. if you are inserting the content into a specific page ID).

What we have been doing in our projects is to create as special app that provides additional commands for the management CLI. You can then keep the migrations separate from data population. Once you deploy your plugin structure live, you can simply run a command to populate the database.

After you have seeded the data, you can simply disable / completely remove the temporary app without having any effect on your main application - compared to keeping tightly coupled data population in the migrations framework, that wastes both space and tightly couples the db migration to your db contents.

like image 94
petr Avatar answered Nov 16 '22 12:11

petr