[ckan-dev] Virtualenv tips: how to reload the ini file

Nigel Babu nigel.babu at okfn.org
Mon Jun 16 04:14:15 UTC 2014


When you run CKAN with paster, that's how you restart it. You stop it and start
it again. Normally, we wouldn't use the kill command, the paster command is
just running on a terminal and I press Ctrl + C to stop and restart it.

If you were running CKAN with Apache, you would run `sudo service apache2
restart`. I have a feeling the --reload parameter is causing confusion here.
You don't need the --reload parameter to reload the paster server. When
developing an extension, it's easier to use paster with --reload because it
restarts the paster server automatically if there's a change in the code.


On Fri, Jun 13, 2014 at 09:31:35PM +1000, John Brisbin wrote:
> G'Day Jason, Mike and Nigel,
>
> My apologies for not being more clear. I've got no strange sysadmin
> operation or agenda going on here...just blindly stumbling along the
> (quite excellent) documentation.
>
> So I got a build from source install up and rolling, running
> searches, all good.
>
> Then it was time to install an extension.
>
> The documentation walked me through the whole process up to  the
> point when it was time to reload the development.ini file (required
> to register the new plugin). At this stage I'm already in an active
> virtualenv, and the website is serving pages.
>
> The documentation says to run the paster command: paster serve
> --reload /etc/ckan/default/development.ini
>
> When I run this we get the "socket in use error." After hours of
> trying to figure this out, Jason gave me the clue that "python is
> already running, so the socket is indeed preoccupied"... solution?
> kill the python process.
>
> Ok, so if I manually kill python (kill -9 (PID)), then the website
> stops running of course...but the paster command runs fine.
>
> The development.ini is reloaded and the website pops back to life.
>
> I exit my shell session. The website is still running. The day continues.
>
> Now it's time to register a new plugin.
>
> I start a new shell session, and activate a virtualenv. You can see
> where this is leading...python is already running...to run the
> paster command I have to first kill the python PID, and then the
> paster will reload the ini and away we go.
>
> So that's the clueless question: it feels like I keep coming into
> the middle of a conversation...like there should be a cleaner way to
> reload the ini than this. But maybe not?
>
> Thanks again for all your work and for the support!
>
> Kind regards,
>
> JB
>
>
>
> On 13/06/2014 12:50 PM, Mike Sinclair wrote:
> >Hi John,
> >
> >Python is not going to be running by default, it has to be
> >invoked, so I'm wondering what happened prior to step 1 above such
> >that python is already running. Is it that you're trying to run
> >paster twice, using separate terminals? Why?
> >
> >It looks like you are serving paster on one terminal and then
> >trying to serve again on another, leading to the conflict.
> >
> >As for joining and leaving the virutalenv - the commands are:
> >
> >$ . /usr/lib/ckan/default/bin/activate
> >$ deactivate
> >
> >Cheers,
> >
> >Mike Sinclair
> >OpenGovGear
> >www.opengovgear.com <http://www.opengovgear.com>
> >
> >
> >On Wed, Jun 11, 2014 at 10:01 PM, John Brisbin <john at boab.info
> ><mailto:john at boab.info>> wrote:
> >
> >    G'Day all,
> >
> >    Thanks to some kindly orientation help from Jason Tan, I have
> >    managed to get python to reload the development.ini file and
> >    proceed onward on the path to creating a custom theme....but not
> >    without some lingering confusion.
> >
> >    This is a request for advice on how to manage the virtualenv
> >    sessions properly.
> >
> >    Starting from a fresh PuTTY login, I run $ netstat -lntp and can
> >    see that there's an existing Python process on a given PID (let's
> >    say 4506)
> >
> >    (1) If I open another shell, activate a virtualenv (.
> >    /usr/lib/ckan/default/bin/activate), and try to run the paster
> >    command:
> >
> >    paster serve --reload /etc/ckan/default/development.ini
> >
> >    we will get the message that the server is starting in some other
> >    socket (eg 5304), and then will get the socket Errno 98 Address
> >    already in use.
> >
> >    (2) If I kill the python process manually, and then re-run the
> >    paster command, the server appears to reload the ini file and
> >    start itself normally.
> >
> >    It doesn't seem right that I have to manually kill Python before
> >    being able to run the --reload, but, given that Python should
> >    always be running, and I don't know how to join (or leave) an
> >    existing virtualenv session, I'm not sure what else to do.
> >
> >    Thanks for any pointers!
> >
> >    Kind regards,
> >
> >    JB
> >
> >
> >
> >    --     John Brisbin
> >    Managing Director, BoaB interactive Pty Ltd
> >    POB 248, MT Molloy QLD 4871
> >
> >    E: john at boab.info <mailto:john at boab.info>
> >    M: 0407 471 565 | P: 07 4094 2172
> >    Skype: boabjohn | Twitter: @boabjohn
> >
> >    _______________________________________________
> >    ckan-dev mailing list
> >    ckan-dev at lists.okfn.org <mailto:ckan-dev at lists.okfn.org>
> >    https://lists.okfn.org/mailman/listinfo/ckan-dev
> >    Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev
> >
> >
>
> --
> John Brisbin
> Managing Director, BoaB interactive Pty Ltd
> POB 248, MT Molloy QLD 4871
>
> E: john at boab.info
> M: 0407 471 565 | P: 07 4094 2172
> Skype: boabjohn | Twitter: @boabjohn
>

> _______________________________________________
> ckan-dev mailing list
> ckan-dev at lists.okfn.org
> https://lists.okfn.org/mailman/listinfo/ckan-dev
> Unsubscribe: https://lists.okfn.org/mailman/options/ckan-dev


--
Nigel Babu
Developer, Open Knowledge



More information about the ckan-dev mailing list