Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1793 (closed task: duplicate)

Opened 11 years ago

Last modified 11 years ago

Document how to properly initialize and prepopulate the database

Reported by: chrisz Owned by: Chris Arndt
Priority: normal Milestone: 1.1
Component: Documentation Version: 1.0.4.4
Severity: normal Keywords: doc task
Cc:

Description

We should document how to properly initialize and prepopulate the databased.

See e.g. the following threads:  http://groups.google.com/group/turbogears/browse_thread/thread/d6cd864216343dca  http://groups.google.com/group/turbogears/browse_thread/thread/6b08939e8eccc4ed

Change History

comment:1 Changed 11 years ago by jorge.vargas

I actually have two ways of making this work.

pre pylons

I though of having tg-admin sql load <file.py>|<file.sql> which will based on filetype/shebang/whatever run the file and report. this command under the hood will do

$ tg-admin sql shell << file.py 

or

$ tg-admin sql sql file.sql

the pylons way

have a standard file, websetup.py in pylons that will take care of this. Which will be run "automagically"

comment:2 Changed 11 years ago by faide

  • Milestone changed from 1.1 to 1.1.1

I personnally add a bootstrap command in the commands.py file and add an entry point for it in my setup.py file.

This generates a myproject-bootstrap.exe (or whatever extension) and then I take care of pre populating by database with everything I need from the script.

  • Pros: deployed with the egg and thus provides necessary command without having to transport a script file
  • Cons: cannot let the user choose the default admin password and this is a little bit unsafe, but I create my users with explicit names like "PLEASE_CHANGE_ASAP" :)

comment:3 Changed 11 years ago by faide

  • Milestone changed from 1.6 to 1.5

comment:4 Changed 11 years ago by faide

  • Milestone changed from 1.5 to 1.1

What do others think of creating such bootstrap scripts in the quickstart templates in order to have examples.

The documentation task would thus be quite easy?

comment:5 Changed 11 years ago by faide

I put this ticket back to 1.1 because this could be added during the beta phase quite easily.

comment:6 Changed 11 years ago by Chris Arndt

  • Keywords doc task added

See ticket #2013 for a patch that implements the solution suggested by faide.

comment:7 Changed 11 years ago by jorge.vargas

  • Status changed from new to closed
  • Resolution set to duplicate

Since both #2013 and this are now doc tickets I'm closing this one as that one has the links to the check ins.

Note: See TracTickets for help on using tickets.