Getting started

De Stoq Wiki
Revisão de 17h04min de 9 de fevereiro de 2012 por Johan Dahlin (Discussão | contribs)

Ir para: navegação, pesquisa


First you need to get all the dependencies installed

On ubuntu, type the following:

   sudo apt-get install python python-gtk2 python-zopeinterface python-psycopg2 python-imaging \
     python-reportlab postgresql postgresql-client python-dateutil python-mako python-gudev \
     python-poppler python-webkit python-twisted-core python-twisted-web librsvg2-common python-xlwt

Downloading the Stoq sources

This is easiest to do using the Stoq plugin for bzr.

It'll download the source for stoq, stoqdrivers and kiwi and help you setup the environment variables and other things needed to run stoq smoothly:

 bzr stoq stoq.launchpad.master

You'll need to run that before running stoq and stoqdbadmin.

Configuring postgresql

You can configure postgresql in a few different way, the easiest is to just create a new database user. To be compatible with the wizard you'll need to create a user with the same username as yours.

On a Debian/Ubuntu system this is accomplished with:

 sudo -u postgres createuser -ds $USER

For other systems, just su / sudo to the postgres user and run createuser -ds

Configuring stoq

When you created a user you need to create an initial stoq.conf, this is easiest to do by using the first time wizard in stoq. It will automatically run if you haven't started stoq before or if you have an empty ~/.stoq directory.

Starting stoq

Then it's enough to just start stoq


Developer options:

 --sql = show all sql commands
 --debug = run in pdb and enable a few debugging only features

Administrating the database

stoqdbadmin contains a couple of commands that will help the development and administration of your stoq database

Pass in -v se be more verbose.


Creates a database shell where you can type SQL commands.


Create a python console with a stoq environment fully setup where you for instance can manipulate domain objects.


Update the database schema to the latest version

Pass in the -b option to avoid creating a backup


Creates a new database.

Pass in the -e option to also create a set of examples, good for developer testing.

This is also used to remove the existing database, when you need to reset it for some reason. But be careful.